Skip to content

Commit

Permalink
ci: add concurrent_test_diff
Browse files Browse the repository at this point in the history
Test the different images in high concurrent.

Signed-off-by: Yadong Ding <ding_yadong@foxmail.com>
  • Loading branch information
Desiki-high committed Aug 17, 2023
1 parent 008e41c commit 25d2301
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/concurrent-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,44 @@ jobs:
wget https://github.com/dragonflyoss/image-service/releases/download/v${{ env.NYDUS_VERSION }}/nydus-static-v${{ env.NYDUS_VERSION }}-linux-amd64.tgz
sudo tar xzvf nydus-static-v${{ env.NYDUS_VERSION }}-linux-amd64.tgz --wildcards --strip-components=1 -C /usr/bin/ nydus-static/*
./script/integration/concurrent/test-same.sh wordpress
concurrent_test_diff:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Golang
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Build Accel
run: |
make
- name: Install Harbor
run: |
wget https://github.com/goharbor/harbor/releases/download/v${{ env.HARBOR_VERSION }}/harbor-offline-installer-v${{ env.HARBOR_VERSION }}.tgz
tar xzvf harbor-offline-installer-v${{ env.HARBOR_VERSION }}.tgz
cp ./script/integration/harbor.yml harbor/harbor.yml
cd harbor
sudo ./install.sh
- name: Prepare Test Image
run: |
images=("wordpress" "nginx" "mysql")
for image in ${images[@]}; do
sudo docker pull $image
sudo docker tag $image localhost/library/$image
done
sudo docker login -u admin -p Harbor12345 localhost
for image in ${images[@]}; do
sudo docker push localhost/library/$image
done
- name: Concurrent Test
run: |
wget https://github.com/dragonflyoss/image-service/releases/download/v${{ env.NYDUS_VERSION }}/nydus-static-v${{ env.NYDUS_VERSION }}-linux-amd64.tgz
sudo tar xzvf nydus-static-v${{ env.NYDUS_VERSION }}-linux-amd64.tgz --wildcards --strip-components=1 -C /usr/bin/ nydus-static/*
./script/integration/concurrent/test-diff.sh
42 changes: 42 additions & 0 deletions script/integration/concurrent/test-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -euo pipefail

# Start acceld service
sudo nohup ./acceld --config ./script/integration/concurrent/config.yaml &> acceld.log &
sleep 1

images=("wordpress" "nginx" "mysql")

# Convert image by accelctl
for image in ${images[@]}; do
./accelctl task create localhost/library/$image:latest
done

while true; do
# Check tasks list
./accelctl task list

# Get tasks status
status=$(./accelctl task list| tail -n +2 | awk '{print $4}')

# Check any FAILED
if echo "$status" | grep -q "FAILED"; then
cat acceld.log
echo "Found a task failed"
exit 1
fi

# Check if all tasks completed
if echo "$status" | grep -q "PROCESSING"; then
cat acceld.log
else
break
fi
done

# check acceld log
cat acceld.log

# Gracefully exit acceld
sudo pkill -SIGINT acceld

0 comments on commit 25d2301

Please sign in to comment.