From a5fbeea615e4103206eab8a5b83b88ad4e6c0c13 Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 3 Mar 2020 00:07:47 +0100 Subject: [PATCH] [CI] Add sample staging tests --- .drone.yml | 7 +++++++ staging_tests.sh | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 staging_tests.sh diff --git a/.drone.yml b/.drone.yml index 70944ea..d7a1972 100644 --- a/.drone.yml +++ b/.drone.yml @@ -96,6 +96,13 @@ steps: exclude: - master +- name: test staging + image: ellerbrock/alpine-bash-curl-ssl + environment: + BRANCH: ${DRONE_COMMIT_BRANCH} + commands: + - bash staging_tests.sh + - name: deploy live image: sinlead/drone-kubectl settings: diff --git a/staging_tests.sh b/staging_tests.sh new file mode 100644 index 0000000..7bc1707 --- /dev/null +++ b/staging_tests.sh @@ -0,0 +1,23 @@ +if [ ${BRANCH} == 'master' ]; then + TEST_URL='http://beer.k3s.kleph.eu' +else + TEST_URL='http://staging.beer.k3s.kleph.eu' +fi +echo "testing URL: ${TEST_URL}" +CURL_OPTS='-s' +# default +curl ${CURL_OPTS} ${TEST_URL} | grep -q 'setHours( 17, 0);' +[ $? -ne 0 ] && exit 1 + +# set 1 parameter +hours=18 +curl ${CURL_OPTS} ${TEST_URL}/${hours} | grep -q "setHours( ${hours}, 0);" +[ $? -ne 0 ] && exit 1 + +# set 2 parameters +minutes=30 +curl ${CURL_OPTS} ${TEST_URL}/${hours}/${minutes} | grep -q "setHours( ${hours}, ${minutes});" +[ $? -ne 0 ] && exit 1 + +echo "OK" +exit 0