feat(test): add pragmas to examples, add example tests to build
This commit is contained in:
parent
cce8671596
commit
b7d0b43fd2
8
Makefile
8
Makefile
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# test rules kubernetes
|
||||||
|
# test tags kubernetes
|
||||||
|
# test exit-status 1
|
||||||
|
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: example
|
||||||
spec:
|
spec:
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# test rules kubernetes
|
||||||
|
# test tags kubernetes
|
||||||
|
# test exit-status 1
|
||||||
|
|
||||||
metadata:
|
metadata:
|
||||||
name: example
|
name: example
|
||||||
spec:
|
spec:
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue