Skip to content

Commit acb63c2

Browse files
committed
ci: use conformance suite's prebuilt compose
1 parent 8415108 commit acb63c2

3 files changed

Lines changed: 40 additions & 70 deletions

File tree

.github/workflows/conformance.yml

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,14 @@ on:
1919
workflow_dispatch:
2020
inputs:
2121
conformance_suite_version:
22-
description: 'Conformance Suite version override, e.g. release-v5.1.39 (takes precedence over vars.CONFORMANCE_SUITE_VERSION)'
22+
description: 'Conformance Suite tag override, e.g. release-v5.1.39 (takes precedence over vars.CONFORMANCE_SUITE_VERSION)'
2323
required: false
2424
type: string
2525

2626
jobs:
27-
build:
28-
if: ${{ github.repository == 'panva/node-oidc-provider' || github.event_name == 'workflow_dispatch' }}
29-
uses: panva/.github/.github/workflows/build-conformance-suite.yml@main
30-
with:
31-
version: ${{ inputs.conformance_suite_version || vars.CONFORMANCE_SUITE_VERSION || '' }}
32-
3327
run:
28+
if: ${{ github.repository == 'panva/node-oidc-provider' || github.event_name == 'workflow_dispatch' }}
3429
runs-on: ubuntu-latest
35-
needs:
36-
- build
37-
env:
38-
SUITE_BASE_URL: https://localhost.emobix.co.uk:8443
39-
SETUP: ${{ toJSON(matrix.setup) }}
4030
strategy:
4131
fail-fast: false
4232
matrix:
@@ -206,6 +196,7 @@ jobs:
206196
DEBUG: oidc-provider:*
207197
ISSUER: https://172.17.0.1:3000
208198
NODE_TLS_REJECT_UNAUTHORIZED: 0
199+
SETUP: ${{ toJSON(matrix.setup) }}
209200
- name: Run oidc-provider (FAPI)
210201
run: |
211202
set -o pipefail
@@ -218,29 +209,21 @@ jobs:
218209
DEBUG: oidc-provider:*
219210
NODE_OPTIONS: --tls-cipher-list="ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384"
220211
NODE_TLS_REJECT_UNAUTHORIZED: 0
221-
- name: Load Cached Conformance Suite Build
222-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
223-
id: cache
224-
with:
225-
path: ./conformance-suite
226-
key: ${{ needs.build.outputs.cache-key }}
227-
fail-on-cache-miss: true
212+
SETUP: ${{ toJSON(matrix.setup) }}
228213
- name: Run Conformance Suite
229-
working-directory: ./conformance-suite
230-
env:
231-
COMPOSE_BAKE: true
232-
run: |
233-
docker compose -f docker-compose-dev.yml up -d
234-
while ! curl -skfail https://localhost.emobix.co.uk:8443/api/runner/available >/dev/null; do sleep 2; done
214+
uses: panva/.github/.github/actions/conformance-suite@main
215+
with:
216+
version-override: ${{ inputs.conformance_suite_version || vars.CONFORMANCE_SUITE_VERSION || '' }}
235217
- name: Adjust configuration files for CI
236218
run: |
237219
sed -i -e 's/op.panva.cz/172.17.0.1:3000/g' certification/oidc/plan.json
238220
sed -i -e 's/mtls.fapi.panva.cz/172.17.0.1:3000/g' certification/fapi/plan.json
239221
sed -i -e 's/fapi.panva.cz/172.17.0.1:3000/g' certification/fapi/plan.json
240222
- name: Run the plan
241-
run: npx mocha --timeout 0 --retries 1 certification/runner
223+
run: npx mocha --timeout 0 --retries 1 --fail-zero certification/runner
242224
env:
243225
NODE_TLS_REJECT_UNAUTHORIZED: 0
226+
SETUP: ${{ toJSON(matrix.setup) }}
244227
- name: Add server log to artifact
245228
if: ${{ failure() }}
246229
run: |
@@ -252,13 +235,9 @@ jobs:
252235
name: certification html results idx(${{ strategy.job-index }})
253236
if-no-files-found: ignore
254237
if: ${{ always() }}
255-
- name: Stop Conformance Suite
256-
working-directory: ./conformance-suite
257-
env:
258-
COMPOSE_BAKE: true
238+
- name: Stop oidc-provider
239+
if: ${{ always() }}
259240
run: |
260-
if [ -n "${{ env.OIDC_PROVIDER_PID }}" ]; then
261-
kill -SIGINT ${{ env.OIDC_PROVIDER_PID }} || true
241+
if [ -n "${OIDC_PROVIDER_PID:-}" ]; then
242+
kill -SIGINT "$OIDC_PROVIDER_PID" || true
262243
fi
263-
docker compose -f docker-compose-dev.yml down
264-
sudo rm -rf mongo

certification/runner/api.js

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ const pipeline = promisify(stream.pipeline);
1111

1212
const FINISHED = new Set(['FINISHED']);
1313
const RESULTS = new Set(['REVIEW', 'PASSED', 'WARNING', 'SKIPPED']);
14+
const MAX_ERROR_BODY_LENGTH = 4000;
15+
16+
async function assertResponseStatus(response, expected) {
17+
if (response.status === expected) {
18+
return;
19+
}
20+
21+
let body = await response.text();
22+
if (body.length > MAX_ERROR_BODY_LENGTH) {
23+
body = `${body.slice(0, MAX_ERROR_BODY_LENGTH)}\n... truncated ...`;
24+
}
25+
26+
throw new Error(`unexpected response code: expected ${expected}, got ${response.status}\n${body || '<empty response body>'}`);
27+
}
1428

1529
class API {
1630
#headers = new Headers({ accept: 'application/json' });
@@ -28,11 +42,7 @@ class API {
2842
async getAllTestModules() {
2943
const response = await fetch(new URL('api/runner/available', this.#baseUrl), { headers: this.#headers });
3044

31-
try {
32-
assert.equal(response.status, 200);
33-
} catch {
34-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
35-
}
45+
await assertResponseStatus(response, 200);
3646

3747
return response.json();
3848
}
@@ -56,11 +66,7 @@ class API {
5666
body: JSON.stringify(configuration),
5767
});
5868

59-
try {
60-
assert.equal(response.status, 201);
61-
} catch {
62-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
63-
}
69+
await assertResponseStatus(response, 201);
6470

6571
return response.json();
6672
}
@@ -79,11 +85,7 @@ class API {
7985
headers: this.#headers,
8086
});
8187

82-
try {
83-
assert.equal(response.status, 201);
84-
} catch {
85-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
86-
}
88+
await assertResponseStatus(response, 201);
8789

8890
return response.json();
8991
}
@@ -93,11 +95,7 @@ class API {
9395

9496
const response = await fetch(new URL(`api/info/${moduleId}`, this.#baseUrl), { headers: this.#headers });
9597

96-
try {
97-
assert.equal(response.status, 200);
98-
} catch {
99-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
100-
}
98+
await assertResponseStatus(response, 200);
10199

102100
return response.json();
103101
}
@@ -107,11 +105,7 @@ class API {
107105

108106
const response = await fetch(new URL(`api/log/${moduleId}`, this.#baseUrl), { headers: this.#headers });
109107

110-
try {
111-
assert.equal(response.status, 200);
112-
} catch {
113-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
114-
}
108+
await assertResponseStatus(response, 200);
115109

116110
return response.json();
117111
}
@@ -129,11 +123,7 @@ class API {
129123
headers.set('accept', 'application/zip');
130124
const response = await fetch(new URL(`api/plan/exporthtml/${planId}`, this.#baseUrl), { headers });
131125

132-
try {
133-
assert.equal(response.status, 200);
134-
} catch {
135-
throw new Error('unexpected response code', { cause: [response.status, await response.text()] });
136-
}
126+
await assertResponseStatus(response, 200);
137127

138128
return pipeline(
139129
response.body,

certification/runner/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { strict as assert } from 'node:assert';
22
import * as fs from 'node:fs';
33

4-
import debug from './debug.js';
54
import API from './api.js';
5+
import debug from './debug.js';
66

77
const {
88
SUITE_ACCESS_TOKEN,
@@ -20,7 +20,7 @@ const {
2020
let SKIP;
2121
let CONFIGURATION;
2222
if (PLAN_NAME.startsWith('fapi')) {
23-
VARIANT.fapi_profile = 'plain_fapi';
23+
VARIANT[PLAN_NAME.includes('ciba') ? 'fapi_ciba_profile' : 'fapi_profile'] = 'plain_fapi';
2424
CONFIGURATION = './certification/fapi/plan.json';
2525
} else {
2626
CONFIGURATION = './certification/oidc/plan.json';
@@ -44,8 +44,6 @@ switch (PLAN_NAME) {
4444
VARIANT.response_type = 'code';
4545
break;
4646
case 'oidcc-basic-certification-test-plan':
47-
// TODO: unskip when https://gitlab.com/openid/conformance-suite/-/issues/1519 is fixed
48-
SKIP = 'oidcc-ensure-post-request-succeeds';
4947
VARIANT.server_metadata = 'discovery';
5048
VARIANT.client_registration = 'dynamic_client';
5149
break;
@@ -204,6 +202,9 @@ try {
204202
}
205203
});
206204
} catch (err) {
207-
console.error(err);
208-
process.exitCode = 1;
205+
describe(PLAN_NAME, () => {
206+
it('creates test plan', () => {
207+
throw err;
208+
});
209+
});
209210
}

0 commit comments

Comments
 (0)