Merge pull request #2695 from dokku/mh/chore/deployment-tasks-tests

add tests for pre/post deploy tasks
This commit is contained in:
Michael Hobbs
2017-04-03 16:32:36 -07:00
committed by GitHub
16 changed files with 111 additions and 1 deletions

View File

@@ -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

View File

@@ -0,0 +1 @@
web

View File

@@ -0,0 +1 @@
/ go

View 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 ./...

View File

@@ -0,0 +1 @@
web: /go/bin/web

View 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"
}
]
}

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -e; test "$(curl -s -S "$1")" == "go"

View 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")
}

View File

@@ -0,0 +1 @@
web

View File

@@ -0,0 +1 @@
/ go

View 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 ./...

View File

@@ -0,0 +1 @@
web: /go/bin/web

View 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"
}
]
}

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -e; test "$(curl -s -S "$1")" == "go"

View 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")
}

View File

@@ -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"