This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testing of s3 connector to devnet integration tests. This change will then remove the need to duplicate integration test setup in motion-s3-connector repo, and would help us catch breaking changes early since the devnet instance started up in `motion` repo builds the motion container from `main` branch.
- Loading branch information
Showing
4 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: AWS CLI S3 Upload Test | ||
description: Creates a file, uploads it using the AWS CLI S3 API, downloads it, and compares the two files. | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Test | ||
run: ./.github/actions/aws-cli-s3-upload-test/upload.sh | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Create a test file to upload | ||
echo fish > upload.txt | ||
|
||
# Create a test bucket, retrying if it fails. | ||
# We do this to ensure we're not failing too early on a connection error. | ||
RETRY_NUM=3 | ||
RETRY_EVERY=15 | ||
NUM=$RETRY_NUM | ||
until aws --endpoint-url http://127.0.0.1:8000 s3 mb s3://test-bucket | ||
do | ||
1>&2 echo Retrying $NUM more times | ||
sleep $RETRY_EVERY | ||
((NUM--)) | ||
|
||
if [ $NUM -eq 0 ] | ||
then | ||
1>&2 echo Bucket was not created after $RETRY_NUM tries | ||
exit 1 | ||
fi | ||
done | ||
|
||
aws --endpoint-url http://127.0.0.1:8000 s3 cp upload.txt s3://test-bucket | ||
aws --endpoint-url http://127.0.0.1:8000 s3 cp s3://test-bucket/upload.txt download.txt | ||
cmp upload.txt download.txt | ||
|
||
# Compare the downloaded file with the original and echo if successful | ||
if cmp upload.txt download.txt | ||
then | ||
1>&2 echo "Uploaded and downloaded files are the same" | ||
else | ||
1>&2 echo "Uploaded and downloaded files are different" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
cloudserver: | ||
image: ghcr.io/filecoin-project/motion-cloudserver:0.1.0 | ||
environment: | ||
REMOTE_MANAGEMENT_DISABLE: 1 | ||
S3DATA: 'multiple' | ||
MOTION_HOST: 'motion' | ||
ports: | ||
- "8000:8000" | ||
|
||
networks: | ||
default: | ||
name: devnet | ||
external: true |