diff --git a/tests.mk b/tests.mk index 39264fd72..106c17d36 100644 --- a/tests.mk +++ b/tests.mk @@ -91,6 +91,14 @@ else @$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH endif +deploy-test-go-fail-predeploy: + @echo deploying go-fail-predeploy app... + cd tests && ./test_deploy ./apps/go-fail-predeploy dokku.me '' true + +deploy-test-go-fail-postdeploy: + @echo deploying go-fail-postdeploy app... + cd tests && ./test_deploy ./apps/go-fail-postdeploy dokku.me '' true + deploy-test-checks-root: @echo deploying checks-root app... cd tests && ./test_deploy ./apps/checks-root dokku.me '' true @@ -166,6 +174,8 @@ deploy-test-static: deploy-tests: @echo running deploy tests... @$(QUIET) $(MAKE) deploy-test-checks-root + @$(QUIET) $(MAKE) deploy-test-go-fail-predeploy + @$(QUIET) $(MAKE) deploy-test-go-fail-postdeploy @$(QUIET) $(MAKE) deploy-test-config @$(QUIET) $(MAKE) deploy-test-clojure @$(QUIET) $(MAKE) deploy-test-dockerfile diff --git a/tests/apps/go-fail-postdeploy/.godir b/tests/apps/go-fail-postdeploy/.godir new file mode 100644 index 000000000..c0772185a --- /dev/null +++ b/tests/apps/go-fail-postdeploy/.godir @@ -0,0 +1 @@ +web diff --git a/tests/apps/go-fail-postdeploy/CHECKS b/tests/apps/go-fail-postdeploy/CHECKS new file mode 100644 index 000000000..52e1189c7 --- /dev/null +++ b/tests/apps/go-fail-postdeploy/CHECKS @@ -0,0 +1 @@ +/ go diff --git a/tests/apps/go-fail-postdeploy/Dockerfile b/tests/apps/go-fail-postdeploy/Dockerfile new file mode 100644 index 000000000..9e748affb --- /dev/null +++ b/tests/apps/go-fail-postdeploy/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.7.5 + +EXPOSE 3000/tcp + +ADD . /go/src/github.com/dokku/apps/web +WORKDIR /go/src/github.com/dokku/apps/web + +RUN go install -v ./... diff --git a/tests/apps/go-fail-postdeploy/Procfile b/tests/apps/go-fail-postdeploy/Procfile new file mode 100644 index 000000000..eabc37787 --- /dev/null +++ b/tests/apps/go-fail-postdeploy/Procfile @@ -0,0 +1 @@ +web: /go/bin/web diff --git a/tests/apps/go-fail-postdeploy/app.json b/tests/apps/go-fail-postdeploy/app.json new file mode 100644 index 000000000..eeb2e3e1d --- /dev/null +++ b/tests/apps/go-fail-postdeploy/app.json @@ -0,0 +1,17 @@ +{ + "name": "Sample go app", + "description": "Used in dokku's test suite", + "website": "http://dokku.viewdocs.io/dokku/", + "repository": "https://github.com/dokku/dokku", + "logo": "https://raw.githubusercontent.com/dokku/dokku/master/docs/assets/dokku.png", + "scripts": { + "dokku": { + "postdeploy": "touch /app/postdeploy.test && ls -la /app" + } + }, + "buildpacks": [ + { + "url": "https://github.com/heroku/heroku-buildpack-go" + } + ] +} diff --git a/tests/apps/go-fail-postdeploy/check_deploy b/tests/apps/go-fail-postdeploy/check_deploy new file mode 100755 index 000000000..980dc933a --- /dev/null +++ b/tests/apps/go-fail-postdeploy/check_deploy @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -e; test "$(curl -s -S "$1")" == "go" diff --git a/tests/apps/go-fail-postdeploy/web.go b/tests/apps/go-fail-postdeploy/web.go new file mode 100644 index 000000000..3bb0cc5c9 --- /dev/null +++ b/tests/apps/go-fail-postdeploy/web.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "net/http" + "os" +) + +func main() { + http.HandleFunc("/", hello) + fmt.Println("listening...") + err := http.ListenAndServe(":"+os.Getenv("PORT"), nil) + if err != nil { + panic(err) + } +} + +func hello(res http.ResponseWriter, req *http.Request) { + fmt.Fprintln(res, "go") +} diff --git a/tests/apps/go-fail-predeploy/.godir b/tests/apps/go-fail-predeploy/.godir new file mode 100644 index 000000000..c0772185a --- /dev/null +++ b/tests/apps/go-fail-predeploy/.godir @@ -0,0 +1 @@ +web diff --git a/tests/apps/go-fail-predeploy/CHECKS b/tests/apps/go-fail-predeploy/CHECKS new file mode 100644 index 000000000..52e1189c7 --- /dev/null +++ b/tests/apps/go-fail-predeploy/CHECKS @@ -0,0 +1 @@ +/ go diff --git a/tests/apps/go-fail-predeploy/Dockerfile b/tests/apps/go-fail-predeploy/Dockerfile new file mode 100644 index 000000000..9e748affb --- /dev/null +++ b/tests/apps/go-fail-predeploy/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.7.5 + +EXPOSE 3000/tcp + +ADD . /go/src/github.com/dokku/apps/web +WORKDIR /go/src/github.com/dokku/apps/web + +RUN go install -v ./... diff --git a/tests/apps/go-fail-predeploy/Procfile b/tests/apps/go-fail-predeploy/Procfile new file mode 100644 index 000000000..eabc37787 --- /dev/null +++ b/tests/apps/go-fail-predeploy/Procfile @@ -0,0 +1 @@ +web: /go/bin/web diff --git a/tests/apps/go-fail-predeploy/app.json b/tests/apps/go-fail-predeploy/app.json new file mode 100644 index 000000000..76574050f --- /dev/null +++ b/tests/apps/go-fail-predeploy/app.json @@ -0,0 +1,17 @@ +{ + "name": "Sample go app", + "description": "Used in dokku's test suite", + "website": "http://dokku.viewdocs.io/dokku/", + "repository": "https://github.com/dokku/dokku", + "logo": "https://raw.githubusercontent.com/dokku/dokku/master/docs/assets/dokku.png", + "scripts": { + "dokku": { + "predeploy": "touch /app/predeploy.test && ls -la /app" + } + }, + "buildpacks": [ + { + "url": "https://github.com/heroku/heroku-buildpack-go" + } + ] +} diff --git a/tests/apps/go-fail-predeploy/check_deploy b/tests/apps/go-fail-predeploy/check_deploy new file mode 100755 index 000000000..980dc933a --- /dev/null +++ b/tests/apps/go-fail-predeploy/check_deploy @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -e; test "$(curl -s -S "$1")" == "go" diff --git a/tests/apps/go-fail-predeploy/web.go b/tests/apps/go-fail-predeploy/web.go new file mode 100644 index 000000000..3bb0cc5c9 --- /dev/null +++ b/tests/apps/go-fail-predeploy/web.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "net/http" + "os" +) + +func main() { + http.HandleFunc("/", hello) + fmt.Println("listening...") + err := http.ListenAndServe(":"+os.Getenv("PORT"), nil) + if err != nil { + panic(err) + } +} + +func hello(res http.ResponseWriter, req *http.Request) { + fmt.Fprintln(res, "go") +} diff --git a/tests/ci/parallel_runner.sh b/tests/ci/parallel_runner.sh index 3d11995ef..0cca6806e 100755 --- a/tests/ci/parallel_runner.sh +++ b/tests/ci/parallel_runner.sh @@ -79,7 +79,7 @@ case "$CIRCLE_NODE_INDEX" in exit $RC fi echo "=====> make deploy tests" - sudo -E make -e deploy-test-checks-root deploy-test-config deploy-test-multi + sudo -E make -e deploy-test-checks-root deploy-test-config deploy-test-multi deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy RC=$? if [[ $RC -ne 0 ]]; then echo "exit status: $RC"