From 7bc2462bf37bcb113c06d28b25e6a39832879bb5 Mon Sep 17 00:00:00 2001 From: James Chartrand Date: Fri, 16 Aug 2024 16:16:45 -0400 Subject: [PATCH] fix healthz test --- src/app.js | 6 ++---- src/test-fixtures/nocks/healthz_status_signing.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index 0d706c7..453d3f9 100644 --- a/src/app.js +++ b/src/app.js @@ -39,10 +39,8 @@ export async function build (opts = {}) { app.get('/healthz', async function (req, res) { try { - const { data } = await axios.post( - `${req.protocol}://${req.headers.host}/instance/${defaultTenantName}/credentials/issue`, - getUnsignedVC() - ) + const endpoint = `${req.protocol}://${req.headers.host}/instance/${defaultTenantName}/credentials/issue` + const { data } = await axios.post(endpoint, getUnsignedVC()) if (!data.proof) { throw new IssuingException(503, 'issuer-coordinator healthz failed') } } catch (e) { console.log(`exception in healthz: ${JSON.stringify(e)}`) diff --git a/src/test-fixtures/nocks/healthz_status_signing.js b/src/test-fixtures/nocks/healthz_status_signing.js index d92e9b9..130612b 100644 --- a/src/test-fixtures/nocks/healthz_status_signing.js +++ b/src/test-fixtures/nocks/healthz_status_signing.js @@ -24,7 +24,7 @@ export default () => { 'timeout=5' ]) nock('http://localhost:4008', { encodedQueryParams: true }) - .post('/credentials/status/allocate', { '@context': ['https://www.w3.org/2018/credentials/v1', 'https://purl.imsglobal.org/spec/ob/v3p0/context.json', 'https://w3id.org/vc/status-list/2021/v1', 'https://w3id.org/security/suites/ed25519-2020/v1'], id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1', type: ['VerifiableCredential', 'OpenBadgeCredential'], issuer: { id: 'did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC', type: 'Profile', name: 'Dr David Malan', description: 'Gordon McKay Professor of the Practice of Computer Science, Harvard University', url: 'https://cs.harvard.edu/malan/', image: { id: 'https://certificates.cs50.io/static/success.jpg', type: 'Image' } }, issuanceDate: '2020-01-01T00:00:00Z', name: 'Introduction to Computer Science - CS50x', credentialSubject: { type: 'AchievementSubject', identifier: { type: 'IdentityObject', identityHash: 'jc.chartrand@gmail.com', hashed: 'false' }, achievement: { id: 'http://cs50.harvard.edu', type: 'Achievement', criteria: { narrative: 'Completion of CS50X, including ten problem sets, ten labs, and one final project.' }, description: 'CS50 congratulates on completion of CS50x.', name: 'Introduction to Computer Science - CS50x' } } }) + .post('/credentials/status/allocate') .reply(200, { '@context': ['https://www.w3.org/2018/credentials/v1', 'https://purl.imsglobal.org/spec/ob/v3p0/context.json', 'https://w3id.org/vc/status-list/2021/v1', 'https://w3id.org/security/suites/ed25519-2020/v1', 'https://w3id.org/vc/status-list/2021/v1'], id: 'urn:uuid:951b475e-b795-43bc-ba8f-a2d01efd2eb1', type: ['VerifiableCredential', 'OpenBadgeCredential'], issuer: { id: 'did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC', type: 'Profile', name: 'Dr David Malan', description: 'Gordon McKay Professor of the Practice of Computer Science, Harvard University', url: 'https://cs.harvard.edu/malan/', image: { id: 'https://certificates.cs50.io/static/success.jpg', type: 'Image' } }, issuanceDate: '2020-01-01T00:00:00Z', name: 'Introduction to Computer Science - CS50x', credentialSubject: { type: 'AchievementSubject', identifier: { type: 'IdentityObject', identityHash: 'jc.chartrand@gmail.com', hashed: 'false' }, achievement: { id: 'http://cs50.harvard.edu', type: 'Achievement', criteria: { narrative: 'Completion of CS50X, including ten problem sets, ten labs, and one final project.' }, description: 'CS50 congratulates on completion of CS50x.', name: 'Introduction to Computer Science - CS50x' } }, credentialStatus: { id: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB#1', type: 'StatusList2021Entry', statusPurpose: 'revocation', statusListIndex: 1, statusListCredential: 'https://jchartrand.github.io/status-test-three/DKSPRCX9WB' } }, [ 'X-Powered-By', 'Express',