From 66c90fc167c585ca79fc920b1b5f51ea7a5349dd Mon Sep 17 00:00:00 2001 From: tchawou-daniel Date: Sat, 16 Jan 2021 23:57:06 +0100 Subject: [PATCH] :wrench: add testbackend.sh file in order to test the back-end code deploy --- .circleci/config.yml | 3 +++ testbackend.sh | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 testbackend.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 818397f..49ab70f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,6 +77,9 @@ jobs: - run: name: Heroku Deploy command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:main + - run: + name: Smoke test + command: ./testbackend.sh buildandpush_dockerhub: docker: - image: docker:17.05.0-ce-git diff --git a/testbackend.sh b/testbackend.sh new file mode 100644 index 0000000..5febb34 --- /dev/null +++ b/testbackend.sh @@ -0,0 +1,5 @@ +HTTPCODE=$(echo `curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` | tr -d ' ') +if [ "$HTTPCODE" -ne 200 ];then + echo "heroku app not responding, failing deploy" + exit 1 +fi \ No newline at end of file