Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use localstack to test aws upload #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ on:
# - synchronize
# - reopened
jobs:
lint:
runs-on: ubuntu-22.04
container:
image: lomorage/lomo-backup:1.0
env:
PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
GOFLAGS: "-buildvcs=false"
steps:
- uses: actions/checkout@v4
- run: make lint

unit-test:
runs-on: ubuntu-22.04
container:
image: lomorage/lomo-backup:1.0
env:
PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
GOBIN: /usr/local/bin
GOFLAGS: "-buildvcs=false"
steps:
- uses: actions/checkout@v4
- run: make unit-tests
# lint:
# runs-on: ubuntu-22.04
# container:
# image: lomorage/lomo-backup:1.0
# env:
# PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
# GOFLAGS: "-buildvcs=false"
# steps:
# - uses: actions/checkout@v4
# - run: make lint
#
# unit-test:
# runs-on: ubuntu-22.04
# container:
# image: lomorage/lomo-backup:1.0
# env:
# PATH: /bin:/usr/bin:/usr/local/bin:/usr/local/go/bin
# GOBIN: /usr/local/bin
# GOFLAGS: "-buildvcs=false"
# steps:
# - uses: actions/checkout@v4
# - run: make unit-tests

e2e-test:
runs-on: ubuntu-22.04
Expand All @@ -40,10 +40,24 @@ jobs:
GOFLAGS: "-buildvcs=false"
WORKDIR: /go/src/github.com/lomorage/lomo-backup
steps:
- run: apt update && apt install -y python3-pip
- name: Start LocalStack
uses: LocalStack/[email protected]
with:
image-tag: '3.4.0'
install-awslocal: 'true'
configuration: DEBUG=1
- name: Run Tests against LocalStack
run: |
awslocal s3 mb s3://test
awslocal s3 ls
curl -v localhost:4566
echo "Test Execution complete!"
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- run: ./dockerfiles/run-localstack.sh
- run: cd test/data; find . | while read -r file; do git log -1 --format="%ad" --date=iso "$file" | xargs -t -I{} touch -d {} "$file"; done
- run: mkdir -p $WORKDIR; rsync -avz * $WORKDIR/; cd $WORKDIR; tree --si -D test/data/
- run: cd $WORKDIR; make install
Expand Down
22 changes: 22 additions & 0 deletions dockerfiles/run-localstack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e
docker run -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack:3.4.0 &

max_retry=10
retry_count=0
while [ $retry_count -lt $max_retry ]; do
if curl 127.0.0.1:4566; then
echo "Localstack is running!"
break
else
echo "Localstack is not yet ready. Retrying in 5 seconds..."
sleep 5
fi
retry_count=$((retry_count + 1))
done

if [ $retry_count -eq $max_retry ]; then
echo "Max retry limit reached. Exiting..."
exit 1
fi
2 changes: 1 addition & 1 deletion test/scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rm -f lomob.db; sqlite3 ./lomob.db < ../../common/dbx/schema/1.sql
./test-iso-list.sh

# test upload raw
#./test-upload-aws-raw.sh
./test-upload-aws-raw.sh

# test upload encrypt file
#./test-upload-aws-encrypt.sh
Loading