Skip to content

Commit

Permalink
Merge pull request oasis-tcs#679 from tschmidtb51/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
tschmidtb51 committed Jan 24, 2024
2 parents 00634fe + de80a3d commit 51d5aab
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 28 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/cpe.yml → .github/workflows/csaf_2.0_cpe.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CPE Dictionary Test
name: CPE Dictionary Test (CSAF 2.0)

on: [push, pull_request]
on:
push:
paths:
- 'csaf_2.0/**'
pull_request:
paths:
- 'csaf_2.0/**'

jobs:
cpe-test:
Expand All @@ -11,6 +17,6 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
- name: Perform CPE Dictionary Test
run: ./csaf_2.0/test/cpe/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CSAF Filenames Test
name: CSAF Filenames Test (CSAF 2.0)

on: [push, pull_request]
on:
push:
paths:
- 'csaf_2.0/**'
pull_request:
paths:
- 'csaf_2.0/**'

jobs:
filename-test:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/main.yml → .github/workflows/csaf_2.0_main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: JSON Schema Tests
name: JSON Schema Tests (CSAF 2.0)

on: [push, pull_request]
on:
push:
paths:
- 'csaf_2.0/**'
pull_request:
paths:
- 'csaf_2.0/**'

jobs:
json-test_job:
Expand Down Expand Up @@ -35,6 +41,6 @@ jobs:
with:
name: strict-schemas
path: |
csaf_strict_schema.json
provider_strict_schema.json
aggregator_strict_schema.json
csaf_2.0/build/csaf_strict_schema.json
csaf_2.0/build/provider_strict_schema.json
csaf_2.0/build/aggregator_strict_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CSAF Mandatory Tests
name: CSAF Mandatory Tests (CSAF 2.0)

on: [push, pull_request]
on:
push:
paths:
- 'csaf_2.0/**'
pull_request:
paths:
- 'csaf_2.0/**'

jobs:
mandatory-test:
Expand All @@ -11,7 +17,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
- name: Setup csaf-validator-lib
run: |
cd ..
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Validator Data Test
name: Validator Data Test (CSAF 2.0)

on: [push, pull_request]
on:
push:
paths:
- 'csaf_2.0/**'
pull_request:
paths:
- 'csaf_2.0/**'

jobs:
validator-test:
Expand Down
12 changes: 7 additions & 5 deletions csaf_2.0/test/aggregator_schema/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash

STRICT_BUILD=csaf_2.0/build
ORIG_SCHEMA=csaf_2.0/json_schema/aggregator_json_schema.json
AGGREGATOR_STRICT_SCHEMA=aggregator_strict_schema.json
CSAF_STRICT_SCHEMA=csaf_strict_schema.json
AGGREGATOR_STRICT_SCHEMA=${STRICT_BUILD}/aggregator_strict_schema.json
CSAF_STRICT_SCHEMA=${STRICT_BUILD}/csaf_strict_schema.json
CVSS_20_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v2.0_strict.json
CVSS_30_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.0_strict.json
CVSS_31_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.1_strict.json
PROVIDER_STRICT_SCHEMA=provider_strict_schema.json
PROVIDER_STRICT_SCHEMA=${STRICT_BUILD}/provider_strict_schema.json
VALIDATOR=csaf_2.0/test/validator.py
STRICT_GENERATOR=csaf_2.0/test/generate_strict_schema.py
TESTPATH=csaf_2.0/examples/aggregator/*.json
Expand All @@ -33,12 +34,13 @@ test_all() {
do
validate $i
done
}
}

SCHEMA=${ORIG_SCHEMA}
test_all

printf "%s" "Generating strict schema ... "
mkdir -p ${STRICT_BUILD}
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${AGGREGATOR_STRICT_SCHEMA}"
printf "%s\n" "done"

Expand Down
8 changes: 5 additions & 3 deletions csaf_2.0/test/csaf_schema/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

STRICT_BUILD=csaf_2.0/build
ORIG_SCHEMA=csaf_2.0/json_schema/csaf_json_schema.json
STRICT_SCHEMA=csaf_strict_schema.json
CSAF_STRICT_SCHEMA=${STRICT_BUILD}/csaf_strict_schema.json
CVSS_20_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v2.0_strict.json
CVSS_30_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.0_strict.json
CVSS_31_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.1_strict.json
Expand Down Expand Up @@ -37,10 +38,11 @@ test_all


printf "%s" "Generating strict schema ... "
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${STRICT_SCHEMA}"
mkdir -p ${STRICT_BUILD}
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${CSAF_STRICT_SCHEMA}"
printf "%s\n" "done"

SCHEMA=${STRICT_SCHEMA}
SCHEMA=${CSAF_STRICT_SCHEMA}
test_all

exit ${FAIL}
6 changes: 4 additions & 2 deletions csaf_2.0/test/provider_schema/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

STRICT_BUILD=csaf_2.0/build
ORIG_SCHEMA=csaf_2.0/json_schema/provider_json_schema.json
CSAF_STRICT_SCHEMA=csaf_strict_schema.json
CSAF_STRICT_SCHEMA=${STRICT_BUILD}/csaf_strict_schema.json
CVSS_20_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v2.0_strict.json
CVSS_30_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.0_strict.json
CVSS_31_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.1_strict.json
PROVIDER_STRICT_SCHEMA=provider_strict_schema.json
PROVIDER_STRICT_SCHEMA=${STRICT_BUILD}/provider_strict_schema.json
VALIDATOR=csaf_2.0/test/validator.py
STRICT_GENERATOR=csaf_2.0/test/generate_strict_schema.py
TESTPATH=csaf_2.0/examples/provider-metadata/*.json
Expand Down Expand Up @@ -38,6 +39,7 @@ SCHEMA=${ORIG_SCHEMA}
test_all

printf "%s" "Generating strict schema ... "
mkdir -p ${STRICT_BUILD}
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${PROVIDER_STRICT_SCHEMA}"
printf "%s\n" "done"

Expand Down
8 changes: 5 additions & 3 deletions csaf_2.0/test/validator/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

STRICT_BUILD=csaf_2.0/build
ORIG_SCHEMA=csaf_2.0/json_schema/csaf_json_schema.json
STRICT_SCHEMA=csaf_strict_schema.json
CSAF_STRICT_SCHEMA=${STRICT_BUILD}/csaf_strict_schema.json
CVSS_20_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v2.0_strict.json
CVSS_30_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.0_strict.json
CVSS_31_STRICT_SCHEMA=csaf_2.0/referenced_schema/first/cvss-v3.1_strict.json
Expand Down Expand Up @@ -46,10 +47,11 @@ test_all


printf "%s" "Generating strict schema ... "
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${STRICT_SCHEMA}"
mkdir -p ${STRICT_BUILD}
python3 "${STRICT_GENERATOR}" "${ORIG_SCHEMA}" > "${CSAF_STRICT_SCHEMA}"
printf "%s\n" "done"

SCHEMA=${STRICT_SCHEMA}
SCHEMA=${CSAF_STRICT_SCHEMA}
test_all_strict

exit ${FAIL}

0 comments on commit 51d5aab

Please sign in to comment.