Enabling API tests in CI

This commit is contained in:
Denis Makogon
2017-07-21 19:35:44 +03:00
committed by James Jeffrey
parent 4ddf7c1454
commit 31e14843fe
4 changed files with 18 additions and 6 deletions

View File

@@ -62,13 +62,13 @@ test_job:
script:
- DOCKER_LOCATION=container_ip ./test.sh
#integration_tests:
# stage: test
# script:
# - go build -o functions-alpine
# - docker build -t funcy/functions:latest .
integration_tests:
stage: test
script:
- go build -o functions-alpine
- docker build -t funcy/functions:latest .
# - make docker-test-run-with-bolt
# - make docker-test-run-with-mysql
- make docker-test-run-with-sqlite3
# - make docker-test-run-with-postgres
# - make docker-test-run-with-redis

View File

@@ -49,6 +49,9 @@ docker-test-run-with-mysql:
docker-test-run-with-postgres:
./api_test.sh postgres
ci-docker-test-run-with-sqlite3:
docker run --rm -i -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e "datastore=sqlite3" funcy/fn-api-tester
docker-test:
docker run -ti --privileged --rm -e LOG_LEVEL=debug \
-v /var/run/docker.sock:/var/run/docker.sock \

View File

@@ -6,6 +6,7 @@ case "$1" in
docker run --name func-server --privileged -v /var/run/docker.sock:/var/run/docker.sock -d -e NO_PROXY -e HTTP_PROXY -e DOCKER_HOST=${DOCKER_HOST} -e LOG_LEVEL=debug -p 8080:8080 funcy/functions
sleep 1
docker logs func-server
;;
"mysql" )
@@ -17,6 +18,7 @@ case "$1" in
export MYSQL_HOST="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' func-mysql-test)"
export MYSQL_PORT=3306
docker run --name func-server --privileged -d -e NO_PROXY -e HTTP_PROXY -e DOCKER_HOST=${DOCKER_HOST} -e LOG_LEVEL=debug -e "DB_URL=mysql://root:root@tcp(${MYSQL_HOST}:${MYSQL_PORT})/funcs" -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock funcy/functions
docker logs func-server
;;
@@ -29,6 +31,7 @@ case "$1" in
export POSTGRES_HOST="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' func-postgres-test)"
export POSTGRES_PORT=5432
docker run --name func-server --privileged -d -e NO_PROXY -e HTTP_PROXY -e DOCKER_HOST=${DOCKER_HOST} -e LOG_LEVEL=debug -e "DB_URL=postgres://postgres:root@${POSTGRES_HOST}:${POSTGRES_PORT}/funcs?sslmode=disable" -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock funcy/functions
docker logs func-server
;;
esac

View File

@@ -0,0 +1,6 @@
FROM funcy/go-dind
ADD . /go/src/gitlab-odx.oracle.com/odx/functions
WORKDIR /go/src/gitlab-odx.oracle.com/odx/functions
CMD ["/bin/sh", "-c", "set -o pipefail && ./api_test.sh sqlite3"]