From f1a4d408e99a359f2762311b3cb0e572101abe10 Mon Sep 17 00:00:00 2001 From: Rob Harrison Date: Thu, 27 Jun 2019 16:24:22 +0100 Subject: [PATCH] Added upload to the unit tests --- postgres-backup-s3/.#README.md | 1 + postgres-backup-s3/integration-tests.sh | 15 +++++++++++++++ postgres-backup-s3/integration-tests.test.yml | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 120000 postgres-backup-s3/.#README.md diff --git a/postgres-backup-s3/.#README.md b/postgres-backup-s3/.#README.md new file mode 120000 index 0000000..a0ebd8e --- /dev/null +++ b/postgres-backup-s3/.#README.md @@ -0,0 +1 @@ +robwithhair@Robs-MacBook.local.5737 \ No newline at end of file diff --git a/postgres-backup-s3/integration-tests.sh b/postgres-backup-s3/integration-tests.sh index 7039bc9..dca4f03 100644 --- a/postgres-backup-s3/integration-tests.sh +++ b/postgres-backup-s3/integration-tests.sh @@ -59,6 +59,21 @@ if [ "$DIFF" != "" ]; then exit 1 fi + +if [ "${S3_S3V4}" = "yes" ]; then + aws configure set default.s3.signature_version s3v4 +fi + +OUT=$(sh backup.sh) +EXPECTED="Creating dump of user database from postgres... +Uploading dump to flowmoco-s3-backup-test +SQL backup uploaded successfully" + +if [ "$OUT" != "$EXPECTED" ]; then + echo "Output '$OUT' does not equal expected '$EXPECTED'" + exit 1 +fi + # apt-get update && apt-get install -y wget # wget "https://sample-videos.com/sql/Sample-SQL-File-10rows.sql" diff --git a/postgres-backup-s3/integration-tests.test.yml b/postgres-backup-s3/integration-tests.test.yml index 841454a..727e4ca 100644 --- a/postgres-backup-s3/integration-tests.test.yml +++ b/postgres-backup-s3/integration-tests.test.yml @@ -9,7 +9,17 @@ services: sut: build: . command: 'sh integration-tests.sh' - environment: - - PGPASSWORD=12345 depends_on: - postgres + environment: + PGPASSWORD: 12345 + S3_REGION: "eu-west-2" + S3_ACCESS_KEY_ID: "AKIASAH3OBJUZI7R3KIM" + S3_SECRET_ACCESS_KEY: "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" + S3_BUCKET: flowmoco-s3-backup-test + S3_PREFIX: "postgres-test" + POSTGRES_HOST: postgres + POSTGRES_DATABASE: user + POSTGRES_USER: user + POSTGRES_PASSWORD: 12345 + POSTGRES_EXTRA_OPTS: '--schema=public --blobs'