From d6744b20e2cc5e15d4f4f92cf4df44a8ef4ff3cb Mon Sep 17 00:00:00 2001 From: Felix Bartels Date: Sat, 24 Aug 2019 15:40:56 +0200 Subject: [PATCH] Add test implementation of goss (#222) * add test target for goss split test-ci up to later add goss to it * bring back chown of /kopano/data * use a dedicated goss file for kopano-server * add todo --- Makefile | 11 ++++++++++- core/goss_server.yaml | 3 +++ core/goss_wait.yaml | 3 +++ core/start-service.sh | 3 +++ webapp/goss.yaml | 8 ++++++++ webapp/goss_wait.yaml | 3 +++ 6 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 core/goss_server.yaml create mode 100644 core/goss_wait.yaml create mode 100644 webapp/goss.yaml create mode 100644 webapp/goss_wait.yaml diff --git a/Makefile b/Makefile index 9ff6db7..b7a8a6e 100644 --- a/Makefile +++ b/Makefile @@ -350,7 +350,10 @@ test-update-env: ## Recreate containers based on updated .env. docker-compose -f $(DOCKERCOMPOSE_FILE) up -d .PHONY: test-ci -test-ci: ## Test if all containers start up +test-ci: test-startup + +.PHONY: test-startup +test-startup: ## Test if all containers start up docker-compose -f $(DOCKERCOMPOSE_FILE) -f tests/test-container.yml build docker-compose -f $(DOCKERCOMPOSE_FILE) up -d docker-compose -f $(DOCKERCOMPOSE_FILE) ps @@ -362,6 +365,12 @@ test-ci: ## Test if all containers start up docker-compose -f $(DOCKERCOMPOSE_FILE) -f tests/test-container.yml stop 2>/dev/null docker ps --filter name=kopano_test* -aq | xargs docker rm -f +# TODO this needs goss added to travis and dcgoss pulled from my own git repo +.PHONY: test-goss +test-goss: ## Test configuration of containers with goss + GOSS_FILES_PATH=core GOSS_FILE="goss_server.yaml" dcgoss run kopano_server + GOSS_FILES_PATH=webapp dcgoss run kopano_webapp + test-security: ## Scan containers with Trivy for known security risks (not part of CI workflow for now). cat $(TAG_FILE) | xargs -I % sh -c 'trivy --exit-code 0 --severity HIGH --quiet --auto-refresh %' cat $(TAG_FILE) | xargs -I % sh -c 'trivy --exit-code 1 --severity CRITICAL --quiet --auto-refresh %' diff --git a/core/goss_server.yaml b/core/goss_server.yaml new file mode 100644 index 0000000..57a45a5 --- /dev/null +++ b/core/goss_server.yaml @@ -0,0 +1,3 @@ +port: + tcp6:236: + listening: true diff --git a/core/goss_wait.yaml b/core/goss_wait.yaml new file mode 100644 index 0000000..57a45a5 --- /dev/null +++ b/core/goss_wait.yaml @@ -0,0 +1,3 @@ +port: + tcp6:236: + listening: true diff --git a/core/start-service.sh b/core/start-service.sh index 50ea311..2d8d683 100755 --- a/core/start-service.sh +++ b/core/start-service.sh @@ -26,6 +26,9 @@ echo "Configure core service '$SERVICE_TO_START'" | ts # ensure removed pid-file on unclean shutdowns and mounted volumes rm -f /var/run/kopano/"$SERVICE_TO_START".pid +echo "Set ownership" | ts +chown kopano:kopano /kopano/data/ /kopano/data/attachments + # allow helper commands given by "docker-compose run" if [ $# -gt 0 ]; then exec "$@" diff --git a/webapp/goss.yaml b/webapp/goss.yaml new file mode 100644 index 0000000..7c520e4 --- /dev/null +++ b/webapp/goss.yaml @@ -0,0 +1,8 @@ +port: + tcp6:9080: + listening: true +process: + kwebd: + running: true + php-fpm7.0: + running: true diff --git a/webapp/goss_wait.yaml b/webapp/goss_wait.yaml new file mode 100644 index 0000000..7dd12ac --- /dev/null +++ b/webapp/goss_wait.yaml @@ -0,0 +1,3 @@ +port: + tcp6:9080: + listening: true