Skip to content

Commit

Permalink
gets duplicated code rate down
Browse files Browse the repository at this point in the history
  • Loading branch information
dagfinno committed Nov 4, 2024
1 parent 7e02e63 commit e7cf0da
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { postSO, getEU, expectStatusFor, expect, describe } from "../../../common/testimports.js";
import { SharedArray } from 'k6/data';
import papaparse from 'https://jslib.k6.io/papaparse/5.1.1/index.js';
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';

import { getDefaultThresholds } from '../../performancetest_common/common.js'
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';

const filenameServiceowners = '../../performancetest_data/.serviceowners-with-tokens.csv';

const serviceOwners = new SharedArray('serviceOwners', function () {
Expand Down Expand Up @@ -36,14 +38,12 @@ export const options = {

},
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'],
thresholds: {
'http_req_duration{name:create dialog}': [],
'http_reqs{name:create dialog}': [],
'http_req_duration{name:simple search}': [],
'http_reqs{name:simple search}': [],
'http_req_duration{name:get dialog}': [],
'http_reqs{name:get dialog}': [],
},
thresholds: getDefaultThresholds(['http_req_duration', 'http_reqs'],[
'create dialog',
'simple search',
'get dialog'
])

};

export function createDialogs() {
Expand Down
11 changes: 5 additions & 6 deletions tests/k6/tests/serviceowner/performance/create-dialog.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { postSO, expect, describe } from "../../../common/testimports.js";
import { SharedArray } from 'k6/data';
import papaparse from 'https://jslib.k6.io/papaparse/5.1.1/index.js';
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';

import { getDefaultThresholds } from '../../performancetest_common/common.js'
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';


const filenameServiceowners = '../../performancetest_data/.serviceowners-with-tokens.csv';
const filenameEndusers = `../../performancetest_data/endusers-${__ENV.API_ENVIRONMENT}.csv`;

Expand All @@ -17,11 +20,7 @@ const endUsers = new SharedArray('endUsers', function () {

export let options = {
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'],
thresholds: {
'http_req_duration{scenario:default}': [`max>=0`],
'http_req_duration{name:create dialog}': [],
'http_reqs{name:create dialog}': [],
},
thresholds: getDefaultThresholds(['http_req_duration', 'http_reqs'],['create dialog'])
};

export default function() {
Expand Down
16 changes: 7 additions & 9 deletions tests/k6/tests/serviceowner/performance/create-remove-dialog.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { postSO, purgeSO, expect, describe } from "../../../common/testimports.js";
import { SharedArray } from 'k6/data';
import papaparse from 'https://jslib.k6.io/papaparse/5.1.1/index.js';
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';
import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';

import { getDefaultThresholds } from '../../performancetest_common/common.js'
import { default as dialogToInsert } from '../../performancetest_data/01-create-dialog.js';

const filenameServiceowners = '../../performancetest_data/.serviceowners-with-tokens.csv';
const filenameEndusers = `../../performancetest_data/endusers-${__ENV.API_ENVIRONMENT}.csv`;

Expand All @@ -17,14 +19,10 @@ const endUsers = new SharedArray('endUsers', function () {

export let options = {
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'],
thresholds: {
http_req_failed: ['rate<0.01'],
'http_req_duration{scenario:default}': [`max>=0`],
'http_req_duration{name:create dialog}': [],
'http_reqs{name:create dialog}': [],
'http_req_duration{name:remove dialog}': [],
'http_reqs{name:remove dialog}': [],
},
thresholds: getDefaultThresholds(['http_req_duration', 'http_reqs'],[
'create dialog',
'remove dialog'
])
};

export default function() {
Expand Down

0 comments on commit e7cf0da

Please sign in to comment.