From 9e9f9ec956fd2c7b177d5d2ce76336059479958c Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 16 Nov 2017 09:23:03 -0800 Subject: [PATCH] Add new integration test against minio Should simulate an S3 test --- .dockerignore | 3 +++ .travis.yml | 3 ++- Makefile | 19 +++++++++++++++++-- docker-compose-test-s3.yml | 29 +++++++++++++++++++++++++++++ docker-compose.yaml | 3 --- test-s3.sh | 6 ++++++ test.sh | 9 ++------- 7 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 docker-compose-test-s3.yml create mode 100755 test-s3.sh diff --git a/.dockerignore b/.dockerignore index 23d6153..2253de8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,7 @@ Dockerfile.* Makefile Readme.md docker-compose.yaml +docker-compose-test-s3.yml test.sh +itest.sh +test-s3.sh diff --git a/.travis.yml b/.travis.yml index 539bf73..c5c56fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,5 @@ services: docker script: - make build-all - - make test + - make test-x86 + - make test-s3-x86 diff --git a/Makefile b/Makefile index a9da3e5..1c0929a 100644 --- a/Makefile +++ b/Makefile @@ -19,15 +19,26 @@ build-all: build-x86 build-arm .PHONY: test-x86 test-x86: build-x86 - ./test.sh $(DOCKER_TAG) ubuntu + ./test.sh $(DOCKER_TAG):ubuntu .PHONY: test-arm test-arm: build-arm - ./test.sh $(DOCKER_TAG) raspbian + ./test.sh $(DOCKER_TAG):raspbian .PHONY: test-all test-all: test-x86 test-arm +.PHONY: test-s3-x86 +test-s3-x86: + ./test-s3.sh ubuntu + +.PHONY: test-s3-arm +test-s3-arm: + ./test-s3.sh raspbian + +.PHONY: test-s3-all +test-s3-all: test-s3-x86 test-s3-arm + .PHONY: shell-x86 shell-x86: build-x86 docker run --rm -it $(DOCKER_TAG):ubuntu bash @@ -38,3 +49,7 @@ shell-arm: build-arm .PHONY: shell shell: shell-x86 + +.PHONY: clean +clean: + docker-compose -f docker-compose-test-s3.yml down -v diff --git a/docker-compose-test-s3.yml b/docker-compose-test-s3.yml new file mode 100644 index 0000000..ea68df5 --- /dev/null +++ b/docker-compose-test-s3.yml @@ -0,0 +1,29 @@ +version: '2' +services: + duplicity: + build: + context: . + dockerfile: Dockerfile.${DOCKER_BASE} + entrypoint: "bash" + command: ["/itest.sh"] + hostname: itest + environment: + SKIP_ON_START: 'true' + OPT_ARGUMENTS: '--s3-unencrypted-connection' + BACKUP_DEST: s3://minio:9000/duplicity + AWS_DEFAULT_REGION: us-east-1 + AWS_ACCESS_KEY_ID: SUPER_SECRET_ACCESS_KEY + AWS_SECRET_ACCESS_KEY: SUPER_SECRET_SECRET_KEY + volumes: + - "./itest.sh:/itest.sh" + links: + - minio + minio: + image: minio/minio + command: server /data + hostname: minio + expose: + - "9000" + environment: + MINIO_ACCESS_KEY: SUPER_SECRET_ACCESS_KEY + MINIO_SECRET_KEY: SUPER_SECRET_SECRET_KEY diff --git a/docker-compose.yaml b/docker-compose.yaml index 1dc720c..8f89d40 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,14 +1,11 @@ version: '2' - services: duplicity: build: . volumes: - - ~/.gnupg:/root/.gnupg:ro - ~/my-backups:/backups - ~/my-data:/data:ro environment: - GPG_KEY_ID: 2CBD492E PASSPHRASE: Correct.Horse.Battery.Staple CLEANUP_COMMAND: remove-older-than 5m CRON_SCHEDULE: "* * * * *" diff --git a/test-s3.sh b/test-s3.sh new file mode 100755 index 0000000..40cbdbc --- /dev/null +++ b/test-s3.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +export DOCKER_BASE=$1 + +docker-compose -f docker-compose-test-s3.yml up \ + --build --abort-on-container-exit --force-recreate diff --git a/test.sh b/test.sh index 785f43f..bf7db2b 100755 --- a/test.sh +++ b/test.sh @@ -1,15 +1,10 @@ #! /bin/bash -image_name=$1 -tag=$2 - -full_image="${image_name}:${tag}" -container_name="${image_name}-${tag}" +image=$1 # Run the test script within the container docker run --rm \ -e SKIP_ON_START=true \ -v "$(pwd)/itest.sh:/itest.sh" \ - --name ${container_name} \ - $full_image \ + $image \ bash -c "/itest.sh"