Merge pull request #2695 from dokku/mh/chore/deployment-tasks-tests
add tests for pre/post deploy tasks
This commit is contained in:
10
tests.mk
10
tests.mk
@@ -91,6 +91,14 @@ else
|
|||||||
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
||||||
endif
|
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:
|
deploy-test-checks-root:
|
||||||
@echo deploying checks-root app...
|
@echo deploying checks-root app...
|
||||||
cd tests && ./test_deploy ./apps/checks-root dokku.me '' true
|
cd tests && ./test_deploy ./apps/checks-root dokku.me '' true
|
||||||
@@ -166,6 +174,8 @@ deploy-test-static:
|
|||||||
deploy-tests:
|
deploy-tests:
|
||||||
@echo running deploy tests...
|
@echo running deploy tests...
|
||||||
@$(QUIET) $(MAKE) deploy-test-checks-root
|
@$(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-config
|
||||||
@$(QUIET) $(MAKE) deploy-test-clojure
|
@$(QUIET) $(MAKE) deploy-test-clojure
|
||||||
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
||||||
|
|||||||
1
tests/apps/go-fail-postdeploy/.godir
Normal file
1
tests/apps/go-fail-postdeploy/.godir
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web
|
||||||
1
tests/apps/go-fail-postdeploy/CHECKS
Normal file
1
tests/apps/go-fail-postdeploy/CHECKS
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/ go
|
||||||
8
tests/apps/go-fail-postdeploy/Dockerfile
Normal file
8
tests/apps/go-fail-postdeploy/Dockerfile
Normal file
@@ -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 ./...
|
||||||
1
tests/apps/go-fail-postdeploy/Procfile
Normal file
1
tests/apps/go-fail-postdeploy/Procfile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web: /go/bin/web
|
||||||
17
tests/apps/go-fail-postdeploy/app.json
Normal file
17
tests/apps/go-fail-postdeploy/app.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2
tests/apps/go-fail-postdeploy/check_deploy
Executable file
2
tests/apps/go-fail-postdeploy/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e; test "$(curl -s -S "$1")" == "go"
|
||||||
20
tests/apps/go-fail-postdeploy/web.go
Normal file
20
tests/apps/go-fail-postdeploy/web.go
Normal file
@@ -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")
|
||||||
|
}
|
||||||
1
tests/apps/go-fail-predeploy/.godir
Normal file
1
tests/apps/go-fail-predeploy/.godir
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web
|
||||||
1
tests/apps/go-fail-predeploy/CHECKS
Normal file
1
tests/apps/go-fail-predeploy/CHECKS
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/ go
|
||||||
8
tests/apps/go-fail-predeploy/Dockerfile
Normal file
8
tests/apps/go-fail-predeploy/Dockerfile
Normal file
@@ -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 ./...
|
||||||
1
tests/apps/go-fail-predeploy/Procfile
Normal file
1
tests/apps/go-fail-predeploy/Procfile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
web: /go/bin/web
|
||||||
17
tests/apps/go-fail-predeploy/app.json
Normal file
17
tests/apps/go-fail-predeploy/app.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2
tests/apps/go-fail-predeploy/check_deploy
Executable file
2
tests/apps/go-fail-predeploy/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e; test "$(curl -s -S "$1")" == "go"
|
||||||
20
tests/apps/go-fail-predeploy/web.go
Normal file
20
tests/apps/go-fail-predeploy/web.go
Normal file
@@ -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")
|
||||||
|
}
|
||||||
@@ -79,7 +79,7 @@ case "$CIRCLE_NODE_INDEX" in
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
echo "=====> make deploy tests"
|
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=$?
|
RC=$?
|
||||||
if [[ $RC -ne 0 ]]; then
|
if [[ $RC -ne 0 ]]; then
|
||||||
echo "exit status: $RC"
|
echo "exit status: $RC"
|
||||||
|
|||||||
Reference in New Issue
Block a user