Skip to content

Commit

Permalink
Add Canary Test in workflow (#7)
Browse files Browse the repository at this point in the history
* Add canary test in workflow

* Use latedst version of docker-hadoop submodule

* Schedule Canary Test to Run Weekly

---------

Co-authored-by: Mohamadamin Karami <[email protected]>
  • Loading branch information
mohamadaminkarami and Mohamadamin Karami authored Nov 29, 2024
1 parent 98c3366 commit 2a3f487
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/canary-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Canary Test

on:
schedule:
- cron: "0 0 * * 0" # Run every Sunday at midnight

jobs:
run-containers-and-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Run Containers
run: |
cd docker-hadoop
chmod +x ./setup-compose.sh
./setup-compose.sh
echo "Waiting for namenode to be ready..."
max_attempts=10
attempt_num=1
until docker exec namenode curl -sf http://localhost:9870 || [ "$attempt_num" -gt "$max_attempts" ]; do
echo "namenode is not ready yet. Retrying in 5 seconds..."
sleep 5
attempt_num=$((attempt_num + 1))
done
if [ "$attempt_num" -le "$max_attempts" ]; then
echo "namenode is ready."
else
echo "namenode did not become ready in time."
exit 1
fi
- name: Run tests
run: |
# Run the commands now that namenode is ready
docker exec nodemanager1 /bin/sh -c "cd \$DISH_TOP && hdfs dfs -put README.md /README.md"
docker exec nodemanager1 /bin/sh -c "cd \$DISH_TOP && ./di.sh ./scripts/sample.sh"
46 changes: 45 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Build, Push Images
name: Docker Build, Push Images and Canary Test

on:
release:
Expand Down Expand Up @@ -284,3 +284,47 @@ jobs:
run: |
docker push binpash/hadoop-submit:${{ env.RELEASE }}
docker push binpash/hadoop-submit:latest
run-containers-and-tests:
runs-on: ubuntu-latest
needs:
- build-hadoop-namenode
- build-hadoop-datanode
- build-hadoop-resourcemanager
- build-hadoop-nodemanager
- build-hadoop-historyserver
- build-hadoop-submit

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Run Containers
run: |
cd docker-hadoop
chmod +x ./setup-compose.sh
./setup-compose.sh
echo "Waiting for namenode to be ready..."
max_attempts=10
attempt_num=1
until docker exec namenode curl -sf http://localhost:9870 || [ "$attempt_num" -gt "$max_attempts" ]; do
echo "namenode is not ready yet. Retrying in 5 seconds..."
sleep 5
attempt_num=$((attempt_num + 1))
done
if [ "$attempt_num" -le "$max_attempts" ]; then
echo "namenode is ready."
else
echo "namenode did not become ready in time."
exit 1
fi
- name: Run tests
run: |
# Run the commands now that namenode is ready
docker exec nodemanager1 /bin/sh -c "cd \$DISH_TOP && hdfs dfs -put README.md /README.md"
docker exec nodemanager1 /bin/sh -c "cd \$DISH_TOP && ./di.sh ./scripts/sample.sh"
2 changes: 1 addition & 1 deletion docker-hadoop

0 comments on commit 2a3f487

Please sign in to comment.