diff --git a/.circleci/config.yml b/.circleci/config.yml index 2308d7ad..972c37b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,12 +34,8 @@ jobs: - run: command: "cat $(which ansible-deploy)" - run: - name: "Simple exec" - command: ansible-deploy || if [ $? -eq 2 ]; then exit 0; fi - - run: - name: "Fail if run without tasks with exit 55" - command: ansible-deploy run || if [ $? -eq 55 ]; then exit 0; fi - + name: "Run shell script for argument parsing" + command: ./tests/01-test_argument_parsing.sh install_and_exec: # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. diff --git a/tests/01-test_argument_parsing.sh b/tests/01-test_argument_parsing.sh new file mode 100755 index 00000000..07320968 --- /dev/null +++ b/tests/01-test_argument_parsing.sh @@ -0,0 +1,19 @@ +#!/bin/bash -l + +check_output() { + CMD=$1 + EXPTEXT=$2 + + eval "$CMD |& grep '$EXPTEXT'" + if [ $? -eq 0 ] + then + echo "OK: '${CMD} returned ${EXPTEXT}'" + else + echo "FAILED: '${CMD}' didn't return '${EXPTEXT}'" + exit 1 + fi +} + +check_output 'ansible-deploy' '\[ERROR\]: To fee arguments' +check_output 'ansible-deploy run' '\[ERROR\]: run requires --task' +