Skip to content

Commit

Permalink
test: update integration tests to spin up s3 server
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Aug 9, 2023
1 parent e8cb96c commit fe60e76
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/docker.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: Start test container
run: |
cd ci
docker-compose up -d wikibase mysql
docker-compose up -d wikibase mysql storage
cd -
- name: Wait for server to accept connections
Expand All @@ -34,16 +34,13 @@ jobs:
-
name: Run backup and show some files
run: |
#create writable dir for non-root
mkdir -p ci/backup-outputs
chmod 777 ci/backup-outputs
# run a backup
cd ci
docker-compose up wbaas_backup
# decompress and list some files
FILE=$(ls backup-outputs/mydumper-backup-*)
tree backup-outputs
FILE=$(ls backup-outputs/backup/output/mydumper-backup-*)
cd ..
BACKUP_KEY=abc123 ./src/decompress_archive.sh ci/$FILE /tmp/output
ls /tmp/output/
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ RUN useradd -u 1234 -m notroot && \
mariadb-client=1:10.1.48-0ubuntu0.18.04.1 && \
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/minio-binaries/mc && \
chmod +x $HOME/minio-binaries/mc && \
mv $HOME/minio-binaries/mc /usr/bin/mc && \
-o "$HOME/minio-binaries/mc" && \
chmod +x "$HOME/minio-binaries/mc" && \
mv "$HOME/minio-binaries/mc" /usr/bin/mc && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

USER notroot
Expand Down
2 changes: 2 additions & 0 deletions ci/.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ QUICKSTATEMENTS_PORT=8840
## ElasticSearch
MW_ELASTIC_HOST=elasticsearch.svc
MW_ELASTIC_PORT=9200

MINIO_IMAGE_NAME=minio/minio:RELEASE.2020-08-04T23-10-51Z
17 changes: 15 additions & 2 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,22 @@ services:
- DO_UPLOAD=1
- BACKUP_KEY=abc123
- EXPECTED_FILES=metadata,my_wiki.page.sql,my_wiki.page-schema.sql
- STORAGE_ENDPOINT=http://storage:9000
- STORAGE_ACCESS_KEY=test
- STORAGE_SECRET_KEY=secret-key-value
- STORAGE_BUCKET_NAME=backup
- DO_CHECK_SECONDARY=0

storage:
image: "${MINIO_IMAGE_NAME}"
environment:
MINIO_ROOT_USER: test
MINIO_ROOT_PASSWORD: test
MINIO_ACCESS_KEY: test
MINIO_SECRET_KEY: secret-key-value
entrypoint: /bin/ash -c 'mkdir -p /data/backup && minio server /data'
volumes:
- ./backup-outputs:/mnt/backup-bucket/:rw
- ./backup-outputs:/data

volumes:
mediawiki-mysql-data:
mediawiki-mysql-data:
2 changes: 1 addition & 1 deletion src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
## GCS bucket is mounted by chart
# We can just move the artifacts
if [ "$DO_UPLOAD" -eq "1" ]; then
./copy.sh
./upload.sh
else
echo "Skipping upload as DO_UPLOAD is not set..."
fi
Expand Down
5 changes: 2 additions & 3 deletions src/upload.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

set -e
mc config host add "$STORAGE_ENDPOINT" "$STORAGE_HMAC_KEY" "$STORAGE_HMAC_SECRET" "$STORAGE_SIGNATURE_VERSION"
mc config add alias remote "$STORAGE_ENDPOINT"
mc cp /backups/output remote/"$STORAGE_BUCKET_NAME"
mc alias set remote "$STORAGE_ENDPOINT" "$STORAGE_ACCESS_KEY" "$STORAGE_SECRET_KEY" --api "$STORAGE_SIGNATURE_VERSION"
mc cp --recursive /backups/output remote/"$STORAGE_BUCKET_NAME"

0 comments on commit fe60e76

Please sign in to comment.