From 127186a72d4b8d30f6ada72ade661d8713490728 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Wed, 7 Jul 2021 12:37:24 +0300 Subject: Rework test env... Move all dockerfiles, docker-compose files into the env folder inside the tests folder. Add elasticmq dockerfile to build SQS compatible test env. Add beanstalk, rabbitmq, sqs to the main tests docker-compose file. Signed-off-by: Valery Piashchynski --- .github/workflows/linux.yml | 4 ++-- Makefile | 12 ++++++------ tests/Dockerfile | 0 tests/docker-compose-jobs.yml | 22 --------------------- tests/docker-compose.yaml | 15 --------------- tests/env/Dockerfile-elastic-mq.yaml | 9 +++++++++ tests/env/custom.conf | 8 ++++++++ tests/env/docker-compose-jobs.yml | 22 +++++++++++++++++++++ tests/env/docker-compose.yaml | 37 ++++++++++++++++++++++++++++++++++++ 9 files changed, 84 insertions(+), 45 deletions(-) delete mode 100644 tests/Dockerfile delete mode 100644 tests/docker-compose-jobs.yml delete mode 100644 tests/docker-compose.yaml create mode 100644 tests/env/Dockerfile-elastic-mq.yaml create mode 100644 tests/env/custom.conf create mode 100644 tests/env/docker-compose-jobs.yml create mode 100644 tests/env/docker-compose.yaml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4679cc24..1d56e8a9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -66,7 +66,7 @@ jobs: - name: Run golang tests on Linux run: | - docker-compose -f ./tests/docker-compose.yaml up -d + docker-compose -f ./tests/env/docker-compose.yaml up -d mkdir ./coverage-ci go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/transport/pipe go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/transport/socket @@ -97,7 +97,7 @@ jobs: go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/broadcast_plugin.txt -covermode=atomic ./tests/plugins/broadcast go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/websockets.txt -covermode=atomic ./tests/plugins/websockets go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/ws_origin.txt -covermode=atomic ./plugins/websockets - docker-compose -f ./tests/docker-compose.yaml down + docker-compose -f ./tests/env/docker-compose.yaml down cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt - uses: codecov/codecov-action@v1 # Docs: diff --git a/Makefile b/Makefile index 625c6788..f02f8e2a 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SHELL = /bin/sh test_coverage: - docker-compose -f tests/docker-compose.yaml up -d --remove-orphans + docker-compose -f tests/env/docker-compose.yaml up -d --remove-orphans rm -rf coverage mkdir coverage go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/pipe.out -covermode=atomic ./pkg/transport/pipe @@ -38,10 +38,10 @@ test_coverage: go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/ws_plugin.out -covermode=atomic ./tests/plugins/websockets go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage/ws_origin.out -covermode=atomic ./plugins/websockets cat ./coverage/*.out > ./coverage/summary.out - docker-compose -f tests/docker-compose.yaml down + docker-compose -f tests/env/docker-compose.yaml down test: ## Run application tests - docker-compose -f tests/docker-compose.yaml up -d + docker-compose -f tests/env/docker-compose.yaml up -d go test -v -race -tags=debug ./pkg/transport/pipe go test -v -race -tags=debug ./pkg/transport/socket go test -v -race -tags=debug ./pkg/pool @@ -71,10 +71,10 @@ test: ## Run application tests go test -v -race -tags=debug ./tests/plugins/broadcast go test -v -race -tags=debug ./tests/plugins/websockets go test -v -race -tags=debug ./plugins/websockets - docker-compose -f tests/docker-compose.yaml down + docker-compose -f tests/env/docker-compose.yaml down testGo1.17beta1: ## Run application tests - docker-compose -f tests/docker-compose.yaml up -d + docker-compose -f tests/env/docker-compose.yaml up -d go1.17beta1 test -v -race -tags=debug ./pkg/transport/pipe go1.17beta1 test -v -race -tags=debug ./pkg/transport/socket go1.17beta1 test -v -race -tags=debug ./pkg/pool @@ -102,4 +102,4 @@ testGo1.17beta1: ## Run application tests go1.17beta1 test -v -race -tags=debug ./tests/plugins/websockets go1.17beta1 test -v -race -tags=debug ./tests/plugins/broadcast go1.17beta1 test -v -race -tags=debug ./plugins/websockets - docker-compose -f tests/docker-compose.yaml down + docker-compose -f tests/env/docker-compose.yaml down diff --git a/tests/Dockerfile b/tests/Dockerfile deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/docker-compose-jobs.yml b/tests/docker-compose-jobs.yml deleted file mode 100644 index 7b88c9cf..00000000 --- a/tests/docker-compose-jobs.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" - -services: - beanstalk: - image: schickling/beanstalkd - ports: - - "11300:11300" - - sqs: - image: vsouza/sqs-local - ports: - - "9324:9324" - - rabbitmq: - image: rabbitmq:3-management - environment: - RABBITMQ_DEFAULT_USER: guest - RABBITMQ_DEFAULT_PASS: guest - RABBITMQ_DEFAULT_VHOST: / - ports: - - "15672:15672" - - "5672:5672" \ No newline at end of file diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml deleted file mode 100644 index b6ba0f66..00000000 --- a/tests/docker-compose.yaml +++ /dev/null @@ -1,15 +0,0 @@ -version: '3' - -services: - memcached: - image: memcached:latest - ports: - - "0.0.0.0:11211:11211" - redis: - image: redis:6 - ports: - - "6379:6379" - redis2: - image: redis:6 - ports: - - "6378:6379" diff --git a/tests/env/Dockerfile-elastic-mq.yaml b/tests/env/Dockerfile-elastic-mq.yaml new file mode 100644 index 00000000..c9f909d0 --- /dev/null +++ b/tests/env/Dockerfile-elastic-mq.yaml @@ -0,0 +1,9 @@ +FROM openjdk:16 + +ADD https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-1.1.1.jar / +COPY custom.conf / +ENTRYPOINT ["java", "-Dconfig.file=custom.conf", "-jar", "/elasticmq-server-1.1.1.jar"] + +EXPOSE 9324 + +CMD ["-help"] diff --git a/tests/env/custom.conf b/tests/env/custom.conf new file mode 100644 index 00000000..9be7730e --- /dev/null +++ b/tests/env/custom.conf @@ -0,0 +1,8 @@ +include classpath("application.conf") + +node-address { + protocol = http + host = "*" + port = 9324 + context-path = "" +} diff --git a/tests/env/docker-compose-jobs.yml b/tests/env/docker-compose-jobs.yml new file mode 100644 index 00000000..7b88c9cf --- /dev/null +++ b/tests/env/docker-compose-jobs.yml @@ -0,0 +1,22 @@ +version: "3" + +services: + beanstalk: + image: schickling/beanstalkd + ports: + - "11300:11300" + + sqs: + image: vsouza/sqs-local + ports: + - "9324:9324" + + rabbitmq: + image: rabbitmq:3-management + environment: + RABBITMQ_DEFAULT_USER: guest + RABBITMQ_DEFAULT_PASS: guest + RABBITMQ_DEFAULT_VHOST: / + ports: + - "15672:15672" + - "5672:5672" \ No newline at end of file diff --git a/tests/env/docker-compose.yaml b/tests/env/docker-compose.yaml new file mode 100644 index 00000000..a407fed4 --- /dev/null +++ b/tests/env/docker-compose.yaml @@ -0,0 +1,37 @@ +version: '3' + +services: + memcached: + image: memcached:latest + ports: + - "0.0.0.0:11211:11211" + redis: + image: redis:6 + ports: + - "6379:6379" + redis2: + image: redis:6 + ports: + - "6378:6379" + + beanstalk: + image: schickling/beanstalkd + ports: + - "11300:11300" + + sqs: + build: + context: . + dockerfile: Dockerfile-elastic-mq.yaml + ports: + - "9324:9324" + + rabbitmq: + image: rabbitmq:3-management + environment: + RABBITMQ_DEFAULT_USER: guest + RABBITMQ_DEFAULT_PASS: guest + RABBITMQ_DEFAULT_VHOST: / + ports: + - "15672:15672" + - "5672:5672" -- cgit v1.2.3