@@ -7,7 +7,7 @@ const creditApplicationAcceptanceRate = new Rate('failed_credit_application_acce
7
7
8
8
export const options = {
9
9
vus : 10 ,
10
- duration : '30s ' ,
10
+ duration : '60s ' ,
11
11
thresholds : {
12
12
'failed_credit_application_creation' : [ 'rate<0.1' ] ,
13
13
'failed_credit_application_acceptance' : [ 'rate<0.1' ] ,
@@ -16,19 +16,17 @@ export const options = {
16
16
} ;
17
17
18
18
export default function ( ) {
19
- const creditApplicationCreation = http . post ( 'http://creditapplication-service.lpt.svc.cluster.local:8080/api/credit-applications' , {
20
- "creditAmount" :10000.00 ,
21
- "firstName" :"Harry" ,
22
- "lastName" :"Potter" ,
23
- "zipCode" :"12345" ,
24
- "occupation" :"IT" ,
25
- "monthlyNetIncome" :3000.00 ,
26
- "monthlyExpenses" :2500.00
19
+ const creditApplicationCreation = http . post ( 'http://creditapplication-k8s-service.lpt.svc.cluster.local:8080/api/credit-applications' , JSON . stringify ( { "creditAmount" :10000.00 , "firstName" :"Jim" , "lastName" :"Beam" , "zipCode" :"12345" , "occupation" :"IT" , "monthlyNetIncome" :5000.00 , "monthlyExpenses" :2500.00 } ) , {
20
+ headers : { 'Content-Type' : 'application/json' } ,
27
21
} ) ;
28
- creditApplicationCreationRate . add ( creditApplicationCreation . status !== 201 ) ;
22
+ console . log ( creditApplicationCreation . status )
23
+ console . log ( creditApplicationCreation . body )
24
+ creditApplicationCreationRate . add ( creditApplicationCreation . status !== 200 ) ;
29
25
const applicationId = creditApplicationCreation . body . id ;
30
26
// after receiving the credit decision, the customer decides within 5 seconds to accept or decline the credit application
31
27
sleep ( 5 ) ;
32
- const creditApplicationAcceptance = http . post ( `http://creditapplication-service.lpt.svc.cluster.local:8080/api/credit-applications/${ applicationId } ` , { } ) ;
33
- creditApplicationAcceptanceRate . add ( creditApplicationAcceptance . status !== 200 ) ;
28
+ const creditApplicationAcceptance = http . post ( `http://creditapplication-k8s-service.lpt.svc.cluster.local:8080/api/credit-applications/${ applicationId } ` , JSON . stringify ( { } ) , {
29
+ headers : { 'Content-Type' : 'application/json' } ,
30
+ } ) ;
31
+ creditApplicationAcceptanceRate . add ( creditApplicationAcceptance . status !== 202 ) ;
34
32
}
0 commit comments