@@ -3,16 +3,23 @@ import { check } from "k6";
33import exec from "k6/execution" ;
44import { CATEGORY_TYPE_GROUPS } from "../type-category-mappings.js" ;
55
6- const csv = open ( "../producer_reference_data.csv" ) ;
6+ const csvPath = __ENV . DIST_PATH
7+ ? `../../../${ __ENV . DIST_PATH } /producer_reference_data.csv`
8+ : "../producer_reference_data.csv" ;
9+ const csv = open ( csvPath ) ;
710const lines = csv . trim ( ) . split ( "\n" ) ;
811// Skip header
912const dataLines = lines . slice ( 1 ) ;
1013
14+ // console.log("__ENV", JSON.stringify(__ENV, null, 2));
15+ console . log ( "__ENV.HOST" , JSON . stringify ( __ENV . HOST , null , 2 ) ) ;
16+
1117function getNextPointer ( ) {
12- // pick the next line accoording to iteration in scenario
18+ // pick the next line according to iteration in scenario
1319 const iter = exec . vu . iterationInScenario ;
1420 const index = iter % dataLines . length ;
1521 const line = dataLines [ index ] ;
22+ console . log ( "🚀 ~ getNextPointer ~ line:" , line ) ;
1623 const [ count , pointer_id , pointer_type , custodian , nhs_number ] = line
1724 . split ( "," )
1825 . map ( ( field ) => field . trim ( ) ) ;
@@ -43,6 +50,7 @@ function getCustodianFromPointerId(pointer_id) {
4350function checkResponse ( res ) {
4451 const is_success = check ( res , { "status is 200" : ( r ) => r . status === 200 } ) ;
4552 if ( ! is_success ) {
53+ console . log ( "🚀 ~ checkResponse ~ res.status:" , res . status ) ;
4654 console . warn ( res . json ( ) ) ;
4755 }
4856}
@@ -60,6 +68,11 @@ export function countDocumentReference() {
6068 const identifier = encodeURIComponent (
6169 `https://fhir.nhs.uk/Id/nhs-number|${ nhs_number } `
6270 ) ;
71+
72+ console . log (
73+ "🚀 ~ countDocumentReference ~ `https://${__ENV.HOST}/consumer/DocumentReference?_summary=count&subject:identifier=${identifier}`:" ,
74+ `https://${ __ENV . HOST } /consumer/DocumentReference?_summary=count&subject:identifier=${ identifier } `
75+ ) ;
6376 const res = http . get (
6477 `https://${ __ENV . HOST } /consumer/DocumentReference?_summary=count&subject:identifier=${ identifier } ` ,
6578 {
@@ -73,6 +86,8 @@ export function readDocumentReference() {
7386 const { pointer_id } = getNextPointer ( ) ;
7487 const custodian = getCustodianFromPointerId ( pointer_id ) ;
7588
89+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
90+
7691 const res = http . get (
7792 `https://${ __ENV . HOST } /consumer/DocumentReference/${ pointer_id } ` ,
7893 {
@@ -92,6 +107,8 @@ export function searchDocumentReference() {
92107 ) ;
93108 const type = encodeURIComponent ( `http://snomed.info/sct|${ pointer_type } ` ) ;
94109
110+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
111+
95112 const res = http . get (
96113 `https://${ __ENV . HOST } /consumer/DocumentReference?subject:identifier=${ identifier } &type=${ type } ` ,
97114 {
@@ -113,6 +130,8 @@ export function searchDocumentReferenceByCategory() {
113130 `http://snomed.info/sct|${ category_code } `
114131 ) ;
115132
133+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
134+
116135 const res = http . get (
117136 `https://${ __ENV . HOST } /consumer/DocumentReference?subject:identifier=${ identifier } &category=${ category } ` ,
118137 {
@@ -131,6 +150,8 @@ export function searchPostDocumentReference() {
131150 type : `http://snomed.info/sct|${ pointer_type } ` ,
132151 } ) ;
133152
153+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
154+
134155 const res = http . post (
135156 `https://${ __ENV . HOST } /consumer/DocumentReference/_search` ,
136157 body ,
@@ -151,6 +172,8 @@ export function searchPostDocumentReferenceByCategory() {
151172 category : `http://snomed.info/sct|${ category_code } ` ,
152173 } ) ;
153174
175+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
176+
154177 const res = http . post (
155178 `https://${ __ENV . HOST } /consumer/DocumentReference/_search` ,
156179 body ,
@@ -168,6 +191,8 @@ export function countPostDocumentReference() {
168191 const body = JSON . stringify ( {
169192 "subject:identifier" : `https://fhir.nhs.uk/Id/nhs-number|${ nhs_number } ` ,
170193 } ) ;
194+
195+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
171196 const res = http . post (
172197 `https://${ __ENV . HOST } /consumer/DocumentReference/_search?_summary=count` ,
173198 body ,
@@ -193,6 +218,9 @@ export function searchPostDocumentReferenceAccessDenied() {
193218 "nrl.ods-code" : deniedCustodian ,
194219 "nrl.app-id" : "K6PerformanceTest" ,
195220 } ) ;
221+
222+ console . log ( "🚀 ~ countDocumentReference ~ __ENV.HOST:" , __ENV . HOST ) ;
223+
196224 const res = http . post (
197225 `https://${ __ENV . HOST } /consumer/DocumentReference/_search` ,
198226 body ,
0 commit comments