1
0
Fork 0

feat(test): add pragmas to examples, add example tests to build

This commit is contained in:
ssube 2019-07-01 08:14:18 -05:00
parent cce8671596
commit b7d0b43fd2
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
6 changed files with 30 additions and 9 deletions

View File

@ -87,9 +87,15 @@ build-bundle: node_modules
build-image: build-bundle build-image: build-bundle
docker build $(ROOT_PATH) docker build $(ROOT_PATH)
test: build-bundle test: test-mocha test-examples
test-mocha: ## run small (unit) tests
test-mocha: build-bundle
$(NODE_BIN)/mocha $(TARGET_PATH)/test.js $(NODE_BIN)/mocha $(TARGET_PATH)/test.js
test-examples: ## run medium (feature) tests
$(SCRIPT_PATH)/test-examples.sh
yarn-install: ## install dependencies from package and lock file yarn-install: ## install dependencies from package and lock file
yarn yarn

View File

@ -1,5 +1,10 @@
# test rules kubernetes
# test tags kubernetes
# test exit-status 1
metadata: metadata:
name: example name: example
labels: {}
spec: spec:
template: template:
spec: spec:

View File

@ -1,5 +1,10 @@
# test rules kubernetes
# test tags kubernetes
# test exit-status 0
metadata: metadata:
name: example name: example
labels: {}
spec: spec:
template: template:
spec: spec:

View File

@ -1,3 +1,7 @@
# test rules kubernetes
# test tags kubernetes
# test exit-status 1
metadata: metadata:
name: example name: example
spec: spec:

View File

@ -1,3 +1,7 @@
# test rules kubernetes
# test tags kubernetes
# test exit-status 1
metadata: metadata:
name: example name: example
spec: spec:

View File

@ -1,5 +1,7 @@
# for each file in examples #! /bin/bash
EXAMPLES="$(find examples -name '*.yml')"
EXAMPLES="$(find ./examples -name '*.yml')"
echo "Found examples: ${EXAMPLES}"
while read -r example; while read -r example;
do do
@ -22,7 +24,7 @@ do
echo "Expected errors: ${EXPECTED_ERRORS}" echo "Expected errors: ${EXPECTED_ERRORS}"
echo "Expected status: ${EXPECTED_STATUS}" echo "Expected status: ${EXPECTED_STATUS}"
node out/index.js --rules rules/${USE_RULES}.yml --tag ${USE_TAGS} --source ${example} node out/index.js --rules "rules/${USE_RULES}.yml" --tag ${USE_TAGS} --source ${example}
ACTUAL_STATUS=$? ACTUAL_STATUS=$?
@ -32,8 +34,3 @@ do
exit 1 exit 1
fi fi
done <<< "${EXAMPLES}" done <<< "${EXAMPLES}"
# read pragmas:
# rules
# tags
# run