digdir / dialogporten

Dialogporten - common API and and metadata state store for digital dialogs
https://docs.altinn.studio/dialogporten
MIT License
1 stars 3 forks source link

test: add more performance tests #1373

Closed dagfinno closed 2 weeks ago

dagfinno commented 3 weeks ago

Description

Added more performance tests and some improvements on github workflow for performance tests

Related Issue(s)

Verification

Documentation

Summary by CodeRabbit

coderabbitai[bot] commented 3 weeks ago
📝 Walkthrough ## Walkthrough The pull request introduces significant updates to K6 performance testing workflows and scripts. The workflow configuration is modified to change default parameters and add new input requirements. Several new files are created for testing GraphQL and end-user functionalities, while existing scripts are updated to improve data handling and error management. Additionally, the removal of outdated performance scripts is noted. Overall, these changes enhance the structure and flexibility of performance testing across various scenarios. ## Changes | File Path | Change Summary | |------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `.github/workflows/dispatch-k6-performance.yml` | - Updated `environment` default value from 'staging' to 'yt01'.
- Added required input parameter `tag` with default value 'Performance test'.
- Changed `vus` default value from 10 to 1.
- Updated `testSuitePath` options and removed old options.
- Updated `run-name` to include dynamic inputs. | | `tests/k6/common/config.js` | - Added new base URL constants for various environments.
- Updated `baseUrls.v1` to use these constants and added a new `graphql` property.
- Introduced `baseUrlGraphql` constant. | | `tests/k6/common/request.js` | - Added import for `baseUrlGraphql`.
- Introduced new function `postGQ` for making GraphQL requests. | | `tests/k6/common/testimports.js` | - Added new export for `postGQ` from `./request.js`. | | `tests/k6/tests/enduser/performance/simple-search.js` | - Removed the entire performance testing script. | | `tests/k6/tests/performancetest_data/01-create-dialog.js` | - Introduced a new function for generating dialog objects for performance testing, including validation and cleanup logic. | | `tests/k6/tests/performancetest_data/graphql-search.js` | - Added new function `getGraphqlParty` for constructing GraphQL query strings. | | `tests/k6/tests/scripts/generate_tokens.sh` | - Modified handling of the `API_ENVIRONMENT` variable to assign "yt01" for the "performance" case. | | `tests/k6/tests/serviceowner/performance/create-dialog.js` | - Updated imports and restructured data handling.
- Replaced `thresholds` property with a call to `getDefaultThresholds`.
- Removed previous implementation of the `createDialog` function. | | `tests/k6/tests/serviceowner/performance/create-remove-dialog.js` | - Enhanced imports and updated performance testing framework to include dynamic thresholds and conditional execution logic. | | `.github/workflows/workflow-run-k6-performance.yml` | - Added `environment` property to the `k6-test` job to utilize specified environment directly. | | `tests/k6/tests/enduser/performance/enduser-search.js` | - Introduced a new performance testing script for end-user search functionality with dynamic thresholds. | | `tests/k6/tests/graphql/performance/graphql-search.js` | - Added a new performance testing script for GraphQL search functionality with flexible execution paths. | | `tests/k6/tests/performancetest_common/createDialog.js` | - Introduced `createDialog` and `createAndRemoveDialog` functions for dialog creation and deletion tests. | | `tests/k6/tests/performancetest_common/getDefaultThresholds.js` | - Added a new function to create a default thresholds configuration for K6 performance tests. | | `tests/k6/tests/performancetest_common/readTestdata.js` | - Introduced functionality for loading and parsing CSV data files for service owners and end users. | | `tests/k6/tests/performancetest_common/simpleSearch.js` | - Introduced functions for testing dialog retrieval and search operations, including error handling and response validation. | | `tests/k6/tests/scenarios/performance/create-dialog-and-search.js` | - Introduced performance testing scenarios for creating dialogs and executing searches with structured options and metrics. | ## Possibly related PRs - **#875**: Enhances authorization checks for dialog entities, potentially impacting performance tests involving dialogs. - **#1110**: Introduces a new activity type related to dialogs, relevant for performance tests tracking dialog states. - **#1240**: Adds tests for the optional `EndUserId` parameter, which may relate to performance tests for different user scenarios. - **#1331**: Directly aligns with the main PR by introducing performance tests for creating dialogs and searching. - **#1367**: Fixes input handling in the K6 dispatch workflow, directly related to updates in the K6 performance testing workflow. - **#1372**: Enhances cleanup functionality for unpurged dialogs, relevant for maintaining test state during performance tests.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
6 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud