Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dagfinno committed Nov 11, 2024
1 parent 8ae8332 commit ef58818
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions tests/k6/tests/serviceowner/performance/purge-dialogs.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
/**
* This script purges dialogs that have not been cleaned up by the tests.
* The script is intended to be run after the main tests have completed.
*
* The script retrieves all dialogs that contain a sentinel value in the search query.
* It then purges these dialogs.
*
* Run: k6 run tests/k6/tests/serviceowner/performance/purge-dialogs.js -e env=yt01
*/
import { getSO, purgeSO } from '../../../common/request.js';
import { serviceOwners } from '../../performancetest_common/readTestdata.js';
import { expect, expectStatusFor } from "../../../common/testimports.js";
import { getDefaultThresholds } from '../../performancetest_common/getDefaultThresholds.js';
import { describe } from '../../../common/describe.js';
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

const sentinelValue = "Performance-created-dialog";
const sentinelValue1 = "dialogporten-e2e-sentinel";
import { sentinelValue } from '../../../common/config.js';

/**
* Retrieves the dialog ids to purge.
*
* @param {Object} serviceOwner - The service owner object.
* @returns {Array} - The dialog ids to purge.
*/
function getDialogs(serviceOwner) {
var paramsWithToken = {
headers: {
Expand Down Expand Up @@ -60,6 +72,11 @@ export function setup() {
return data;
}

/**
* Purges dialogs.
* In single user mode, the first service owner is used. Only one iteration is performed.
* In multi user mode, all service owners are used.
*/
export default function(serviceOwners) {
if (!serviceOwners || serviceOwners.length === 0) {
throw new Error('No service owners loaded for testing');
Expand All @@ -76,6 +93,11 @@ export default function(serviceOwners) {
}
}

/**
* Purges dialogs.
*
* @param {Object} serviceOwner - The service owner object.
*/
export function purgeDialogs(serviceOwner) {
var paramsWithToken = {
headers: {
Expand Down

0 comments on commit ef58818

Please sign in to comment.