diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml new file mode 100644 index 0000000000..31dfb80a05 --- /dev/null +++ b/.github/workflows/weekly.yml @@ -0,0 +1,54 @@ +name: Weekly tests + +permissions: + contents: read + +concurrency: + group: weekly-${{ github.ref }} + cancel-in-progress: true + +on: + schedule: + - cron: "0 0 * * 1" + workflow_dispatch: + +jobs: + weekly_longevity: + name: Weekly Longevity test + runs-on: ${{ matrix.os }} + timeout-minutes: 120 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + rust-target: [x86_64-unknown-linux-musl] + steps: + - uses: actions/checkout@v4 + - name: Setup Fluvio + uses: infinyon/fluvio/.github/actions/setup-fluvio@master + with: + version: latest + - name: Run Resume test + timeout-minutes: 60 + run: | + FLUVIO_BIN=fluvio INTERACTIONS=100 make resume-test + - name: Run diagnostics + if: failure() + timeout-minutes: 5 + run: fluvio cluster diagnostics + - name: Upload diagnostics + uses: actions/upload-artifact@v4 + timeout-minutes: 5 + if: failure() + with: + name: weekly-longevity.diag + path: diagnostics*.gz + - name: Slack Notification + uses: 8398a7/action-slack@v3 + if: ${{ !success() }} + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + MATRIX_CONTEXT: ${{ toJson(matrix) }} diff --git a/makefiles/test.mk b/makefiles/test.mk index 7f9cd8b154..5f4734e8fb 100644 --- a/makefiles/test.mk +++ b/makefiles/test.mk @@ -187,6 +187,16 @@ upgrade-test: build-cli build_k8_image ./tests/upgrade-test.sh endif +ifeq (${CI},true) +# In CI, we expect all artifacts to already be built and loaded for the script +resume-test: + ./tests/local-resume-test.sh +else +# When not in CI (i.e. development), load the dev k8 image before running test +resume-test: build-cli + ./tests/local-resume-test.sh +endif + # When running in development, might need to run `cargo clean` to ensure correct fluvio binary is used validate-release-stable: ./tests/fluvio-validate-release.sh $(VERSION) $(GIT_COMMIT) diff --git a/tests/local-resume-test.sh b/tests/local-resume-test.sh new file mode 100755 index 0000000000..26dd161391 --- /dev/null +++ b/tests/local-resume-test.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +readonly INTERACTIONS=${INTERACTIONS:-5} + +function run_test() { + ${FLUVIO_BIN} cluster delete --force + ${FLUVIO_BIN} cluster start --local + + seq 1 10 | parallel -j 10 ${FLUVIO_BIN} topic create test-topic-{} + seq 1 10 | parallel -j 10 ${FLUVIO_BIN} remote register test-remote-{} + + ${FLUVIO_BIN} cluster shutdown + ${FLUVIO_BIN} cluster resume + + # Create topic + ${FLUVIO_BIN} topic create test-topic-11 # THIS WAS HANGING + + TOPIC_LIST=$(${FLUVIO_BIN} topic list 2>/dev/null) + PARTITION_LIST=$(${FLUVIO_BIN} partition list 2>/dev/null) + REMOTE_LIST=$(${FLUVIO_BIN} remote list 2>/dev/null) + + # Check if the topic list has 11+1 lines + if [ $(echo "$TOPIC_LIST" | wc -l) -eq 12 ]; then + echo "PASS" + else + echo "FAIL" + exit 1 + fi + + # Check if the partition list has 11+1 lines + if [ $(echo "$PARTITION_LIST" | wc -l) -eq 12 ]; then + echo "PASS" + else + echo "FAIL" + exit 1 + fi + + # Check if the remote list has 10+1 lines + if [ $(echo "$REMOTE_LIST" | wc -l) -eq 11 ]; then + echo "PASS" + else + echo "FAIL" + exit 1 + fi +} + +function main() { + for i in $(seq 1 $INTERACTIONS); + do + echo "INTERATION: $i" + run_test + done +} + +main;