Skip to content

Commit

Permalink
test: added k6 performance testing for REST API issuance
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb committed Jun 26, 2023
1 parent b5b72a0 commit 83a9084
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions k6/issuance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import http from 'k6/http';
import { check } from 'k6';

export const options = {
thresholds: {
http_req_failed: ['rate==0'], // not a single http request may fail
http_req_duration: ['p(95)<10'], // 95% of requests have to be below 10ms
checks: ['rate==1'], // all checks must pass
},
vus: 24,
duration: '60s',
};

export default function () {
const payload = `{"templateId":"VerifiableId","config":{"issuerDid":"did:key:z6Mkr6T1hhzQRt3ySK4SxMQAAgxNUprhx8VYZwk6nyHeN1kQ","subjectDid":"did:key:z6Mkr6T1hhzQRt3ySK4SxMQAAgxNUprhx8VYZwk6nyHeN1kQ"}}`

const res = http.post('http://127.0.0.1:7001/v1/credentials/issue', payload, {
headers: {
'Content-Type': 'application/json',
},
});

check(res, {
'is status 200': (r) => r.status === 200,
'verify JWT': (r) => r.body.startsWith("ey")
})
}

0 comments on commit 83a9084

Please sign in to comment.