Skip to content

Commit

Permalink
Update tests/k6/tests/enduser/performance/simple-search.js
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
dagfinno and coderabbitai[bot] authored Oct 23, 2024
1 parent 335e164 commit 7604ae1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/k6/tests/enduser/performance/simple-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ import { randomItem } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
const filenameEndusers = '../../performancetest_data/.endusers-with-tokens.csv';

const endUsers = new SharedArray('endUsers', function () {
return papaparse.parse(open(filenameEndusers), { header: true, skipEmptyLines: true }).data;
});
try {
const csvData = papaparse.parse(open(filenameEndusers), { header: true, skipEmptyLines: true }).data;
if (!csvData.length) {
throw new Error('No data found in CSV file');
}
csvData.forEach((user, index) => {
if (!user.token || !user.ssn) {
throw new Error(`Missing required fields at row ${index + 1}`);
}
});
return csvData;
} catch (error) {
throw new Error(`Failed to load end users: ${error.message}`);
}
});

export let options = {
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)', 'p(99.5)', 'p(99.9)', 'count'],
Expand Down

0 comments on commit 7604ae1

Please sign in to comment.