-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(performance): Performance/create serviceowner search (#1413)
Add a simple serviceowner search on enduser(ssn) and service resource ## Description <!--- Describe your changes in detail --> ## Related Issue(s) - #1326 ## Verification - [ ] **Your** code builds clean without any errors or warnings - [ ] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new performance testing script for service owner searches. - Added functionality to perform searches specifically for service owners. - **Improvements** - Enhanced existing search functionality for end users. - Updated performance metrics tracking to reflect the new focus on end user searches. - **Bug Fixes** - Improved URL construction in the token generation script for better handling of special characters. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
6 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
org,orgno,scopes,resource | ||
digdir,991825827,digdir:dialogporten.serviceprovider,super-simple-service | ||
digdir,991825827,digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search,ttd-dialogporten-performance-test-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/k6/tests/serviceowner/performance/serviceowner-search.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.1.0/index.js'; | ||
import { serviceownerSearch } from '../../performancetest_common/simpleSearch.js' | ||
import { getDefaultThresholds } from '../../performancetest_common/getDefaultThresholds.js'; | ||
import { serviceOwners ,endUsersWithTokens } from '../../performancetest_common/readTestdata.js'; | ||
|
||
const tag_name = 'serviceowner search'; | ||
|
||
export let options = { | ||
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'], | ||
thresholds: getDefaultThresholds(['http_req_duration', 'http_reqs'],[tag_name]) | ||
}; | ||
|
||
/** | ||
* Perform a service owner search. | ||
* In single user mode, the first service owner and end user with token is used. Only one iteration is performed. | ||
* In multi user mode, a random service owner and end user with token is used. | ||
*/ | ||
export default function() { | ||
if (!endUsersWithTokens || endUsersWithTokens.length === 0) { | ||
throw new Error('No end users loaded for testing'); | ||
} | ||
if (!serviceOwners || serviceOwners.length === 0) { | ||
throw new Error('No service owners loaded for testing'); | ||
} | ||
|
||
const isSingleUserMode = (options.vus ?? 1) === 1 && (options.iterations ?? 1) === 1 && (options.duration ?? 0) === 0; | ||
if (isSingleUserMode) { | ||
serviceownerSearch(serviceOwners[0], endUsersWithTokens[0], tag_name); | ||
} | ||
else { | ||
serviceownerSearch(randomItem(serviceOwners), randomItem(endUsersWithTokens), tag_name); | ||
} | ||
} | ||
|