1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 16:06:14 +00:00

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
This commit is contained in:
Felix Bartels 2019-08-24 15:40:56 +02:00 committed by GitHub
parent a7f0d298ad
commit d6744b20e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 1 deletions

View File

@ -350,7 +350,10 @@ test-update-env: ## Recreate containers based on updated .env.
docker-compose -f $(DOCKERCOMPOSE_FILE) up -d docker-compose -f $(DOCKERCOMPOSE_FILE) up -d
.PHONY: test-ci .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) -f tests/test-container.yml build
docker-compose -f $(DOCKERCOMPOSE_FILE) up -d docker-compose -f $(DOCKERCOMPOSE_FILE) up -d
docker-compose -f $(DOCKERCOMPOSE_FILE) ps 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-compose -f $(DOCKERCOMPOSE_FILE) -f tests/test-container.yml stop 2>/dev/null
docker ps --filter name=kopano_test* -aq | xargs docker rm -f 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). 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 0 --severity HIGH --quiet --auto-refresh %'
cat $(TAG_FILE) | xargs -I % sh -c 'trivy --exit-code 1 --severity CRITICAL --quiet --auto-refresh %' cat $(TAG_FILE) | xargs -I % sh -c 'trivy --exit-code 1 --severity CRITICAL --quiet --auto-refresh %'

3
core/goss_server.yaml Normal file
View File

@ -0,0 +1,3 @@
port:
tcp6:236:
listening: true

3
core/goss_wait.yaml Normal file
View File

@ -0,0 +1,3 @@
port:
tcp6:236:
listening: true

View File

@ -26,6 +26,9 @@ echo "Configure core service '$SERVICE_TO_START'" | ts
# ensure removed pid-file on unclean shutdowns and mounted volumes # ensure removed pid-file on unclean shutdowns and mounted volumes
rm -f /var/run/kopano/"$SERVICE_TO_START".pid 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" # allow helper commands given by "docker-compose run"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
exec "$@" exec "$@"

8
webapp/goss.yaml Normal file
View File

@ -0,0 +1,8 @@
port:
tcp6:9080:
listening: true
process:
kwebd:
running: true
php-fpm7.0:
running: true

3
webapp/goss_wait.yaml Normal file
View File

@ -0,0 +1,3 @@
port:
tcp6:9080:
listening: true