From 80f9bb137c2b99d625e17f191d16e79ee4f8470e Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Dec 04 2017 15:22:22 +0000 Subject: add test that validates that all files have an .sls extension --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad869cd..e6942b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,12 @@ stages: - test - deploy +test_extension: + stage: test + script: bin/test_extension.sh + tags: + - docker + test_secrets: stage: test script: bin/test_secrets.sh diff --git a/bin/run_tests_locally.sh b/bin/run_tests_locally.sh index 4f0f591..2618f4c 100755 --- a/bin/run_tests_locally.sh +++ b/bin/run_tests_locally.sh @@ -29,6 +29,7 @@ SALT_DIRS=( /var/cache/salt ) +bin/test_extension.sh bin/test_secrets.sh bin/test_roles.py bin/test_custom_grains.py diff --git a/bin/test_extension.sh b/bin/test_extension.sh new file mode 100755 index 0000000..9a898aa --- /dev/null +++ b/bin/test_extension.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +NON_SLS_PILLAR=$(find pillar -type f | egrep -v "(macros.jinja|valid_custom_grains.yaml|.sls$)") +NON_SLS_SALT=$(find salt -type f | egrep -v "/(files|templates)/|salt/profile/apparmor/pillar.example|.sls$") +NON_SLS=( ${NON_SLS_PILLAR} ${NON_SLS_SALT} ) + +if [[ -n $NON_SLS ]]; then + echo "The following files are missing the .sls extension:" + for file in ${NON_SLS[@]}; do + echo ${file} + done + exit 1 +fi