diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 06435dfab..ec75e28e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/Makefile b/Makefile index 15bda2df6..410057a4b 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/api_test.sh b/api_test.sh index e34afffc4..454515c24 100755 --- a/api_test.sh +++ b/api_test.sh @@ -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 diff --git a/test/fn-api-tests/Dockerfile b/test/fn-api-tests/Dockerfile new file mode 100644 index 000000000..97f807269 --- /dev/null +++ b/test/fn-api-tests/Dockerfile @@ -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"]