I wrote some tests which should fail (return 1). If I redirect the error to /dev/null will the pipeline break? Should this work in Github actions?
if [ -d "failing_tests" ]; then
for test in failing_tests/*
do
helm lint --strict --values "$test" > /dev/null 2>&1
exit_code=$?
if [ $exit_code -ne 1 ]; then
echo "failing test passed (error)"!
mv "_values.yaml" "values.yaml"
exit 1
fi
nr_tests=$((nr_tests+1))
done
fi
(I renamed the values.yaml)
runs-on: ubuntu-latest
This is how the entire step looks like:
- name: Running the unit tests
run: |
find charts -name "values.schema.json" -exec dirname {} \; |
while read directory; do
cd "$directory"
nr_tests=0
mv "values.yaml" "_values.yaml"
if [ -d "passing_tests" ]; then
for test in passing_tests/*
do
helm lint --values "$test" > /dev/null 2>&1
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "passing test: $test failed (error)"!
mv "_values.yaml" "values.yaml"
exit 1
fi
nr_tests=$((nr_tests+1))
done
fi
if [ -d "failing_tests" ]; then
for test in failing_tests/*
do
helm lint --strict --values "$test" > /dev/null 2>&1
exit_code=$?
if [ $exit_code -ne 1 ]; then
echo "failing test passed (error)"!
mv "_values.yaml" "values.yaml"
exit 1
fi
nr_tests=$((nr_tests+1))
done
fi
mv "_values.yaml" "values.yaml"
cd - > /dev/null
echo "$nr_tests (all) tests in $directory succeed"
done
I have no problem with the passing tests.