Skip to content

Commit 0277083

Browse files
author
gabe
committed
run docker properly
1 parent 1584c7c commit 0277083

File tree

7 files changed

+34
-35
lines changed

7 files changed

+34
-35
lines changed

implementations/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ export const implementationsWhichSupportVersionAndType = ({
3030
}
3131
return matchingImpls;
3232
};
33-
34-
export const containerNameForImplementation = (implementation) => {
35-
return implementations.findLast((i) => i.name === implementation).docker_image;
36-
};

implementations/sample.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
{
2-
"name": "sample",
3-
"docker_image": "sample-image:latest",
2+
"name": "tbd",
43
"specs": {
54
"2020-12": [
65
"JsonSchema",
76
"JsonSchemaCredential"
8-
],
9-
"2019-09": [
10-
"JsonSchema",
11-
"JsonSchemaCredential"
12-
],
13-
"Draft-7": [
14-
"JsonSchema",
15-
"JsonSchemaCredential"
167
]
178
}
189
}

package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
"bugs": {
3232
"url": "https://github.com/w3c/vc-json-schema-test-suite/issues"
3333
},
34+
"compilerOptions": {
35+
"target": "ESNext",
36+
"module": "ESNext",
37+
"moduleResolution": "node"
38+
},
3439
"dependencies": {
3540
"@digitalbazaar/did-method-key": "^5.1.0",
3641
"@digitalbazaar/ecdsa-multikey": "^1.1.3",
@@ -41,6 +46,7 @@
4146
"base58-universal": "^2.0.0",
4247
"chai": "^4.3.7",
4348
"data-integrity-test-suite-assertion": "github:w3c-ccg/data-integrity-test-suite-assertion",
49+
"jsh": "^0.43.0",
4450
"jsonld-document-loader": "^2.0.0",
4551
"klona": "^2.0.6",
4652
"mocha": "^10.2.0",

reports/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,22 @@
114114
<section class="informative" id="conformance-testing-results">
115115
<h2> Conformance Testing Results </h2>
116116
<p>
117-
Tests passed 30/33 90%
117+
Tests passed 10/11 90%
118118
</p>
119119
<p>
120-
Tests failed 3/33 10%
120+
Tests failed 1/11 10%
121121
</p>
122122
<p>
123-
Failures 3
123+
Failures 1
124124
</p>
125125
<p>
126126
Tests skipped 0
127127
</p>
128128
<p>
129-
Total tests 33
129+
Total tests 11
130130
</p>
131131
<p>
132-
These tests were run on <time>24 August 2023 at 4:19 pm UTC</time>
132+
These tests were run on <time>24 August 2023 at 4:56 pm UTC</time>
133133
</p>
134134
<section class="informative" id="Key">
135135
<h3>Key</h3>

tests/jsonschema.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {generateTestResult, checkTestResult, TestResult} from './testutil.js';
77
const schemaVersions = Object.keys(JsonSchemaVersions);
88
schemaVersions.forEach((schemaVersion) => {
99
const schemaVersionName = JsonSchemaVersions[schemaVersion];
10-
describe(`JSON Schema ${schemaVersionName.name} - JsonSchema`, function() {
10+
describe(`JSON Schema ${schemaVersionName} - JsonSchema`, function() {
1111
const impls = implementationsWhichSupportVersionAndType(
1212
{version: schemaVersionName, type: VcJsonSchemaTypes.JsonSchema});
1313
const implNames = impls.map((i) => i.name);

tests/testutil.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import shell from 'shelljs';
21
import * as fs from 'fs';
3-
import {containerNameForImplementation} from '../implementations/index.js';
2+
import shell from 'shelljs';
43

54
/**
65
* Generate test results for a given implementation by calling its docker container with specific inputs
@@ -12,28 +11,23 @@ import {containerNameForImplementation} from '../implementations/index.js';
1211
*/
1312
export async function generateTestResult(impl, jsonSchemaVersion, jsonSchemaType, testNumber) {
1413
const schemaType = jsonSchemaType.toLowerCase();
15-
const containerName = containerNameForImplementation(impl);
1614
const schemaFile = `${testNumber}-schema.json`;
1715
const credentialFile = `${testNumber}-credential.json`;
1816
const outputFile = `${testNumber}-${impl}.json`;
1917

2018
const command = `
21-
IMPLEMENTATION=${containerName}
22-
FORMAT=${schemaType}
23-
SCHEMA=/tests/input/${schemaType}/${jsonSchemaVersion}/${schemaFile}
24-
CREDENTIAL=/tests/input/${schemaType}/${jsonSchemaVersion}/${credentialFile}
25-
OUTPUT=/tests/input/${schemaType}/${jsonSchemaVersion}/${outputFile}
26-
27-
docker-compose run -d $IMPLEMENTATION \
19+
docker-compose -f ./implementations/docker-compose.yml \
20+
run -d ${impl} \
2821
validate \
29-
--format $FORMAT \
30-
--schema $SCHEMA \
31-
--credential $CREDENTIAL \
32-
--output $OUTPUT
22+
--format ${jsonSchemaType} \
23+
--schema /tests/input/${schemaType}/${jsonSchemaVersion}/${schemaFile} \
24+
--credential /tests/input/${schemaType}/${jsonSchemaVersion}/${credentialFile} \
25+
--output /tests/output/${schemaType}/${jsonSchemaVersion}/${outputFile}
3326
`;
3427

3528
console.log(`${command}`);
36-
const {code, stdout} = shell.exec(command, {silent: true});
29+
shell.set('-e');
30+
const {code, stdout} = shell.exec(command, {silent: false});
3731
if (code !== 0) {
3832
console.warn(stdout);
3933
}

0 commit comments

Comments
 (0)