diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 491b7018d0..e3fe1459fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1429,6 +1429,55 @@ jobs: timeout-minutes: 5 run: cat /tmp/flv_sc.log + cli_backward_compatibility: + runs-on: ${{ matrix.os }} + env: + FLUVIO_BIN: "~/bin/fluvio" + needs: + - build_image + - config + strategy: + matrix: + os: [ubuntu-latest] + rust-target: [x86_64-unknown-linux-musl] + steps: + - uses: actions/checkout@v4 + - name: Setup BATS + uses: mig4/setup-bats@v1 + with: + bats-version: ${{ env.BATS_VERSION }} + + # Download artifacts from development build + - name: Download artifact - fluvio + uses: actions/download-artifact@v4 + with: + name: fluvio-${{ matrix.rust-target }} + path: ~/bin + + - name: Download artifact - fluvio-run + uses: actions/download-artifact@v4 + with: + name: fluvio-run-${{ matrix.rust-target }} + path: ~/.fluvio/extensions + + - name: Set up Fluvio Binaries + run: | + chmod +x ~/bin/fluvio ~/.fluvio/extensions/fluvio-run + echo "~/bin" >> $GITHUB_PATH + FLUVIO_BIN=~/bin/fluvio + echo "FLUVIO_BIN=${FLUVIO_BIN}" >> $GITHUB_ENV + + - name: Print version + run: fluvio version + + - name: Run backward compatibility tests + timeout-minutes: 10 + run: make cli-backward-compatibility-test + + - name: Print SC logs + if: ${{ !success() }} + timeout-minutes: 5 + run: cat /tmp/flv_sc.log # Runs tests on `tests/cli/partition_test` partition_test: diff --git a/crates/fluvio-sc-schema/src/objects/watch.rs b/crates/fluvio-sc-schema/src/objects/watch.rs index ff8ceab346..89c7cb9a79 100644 --- a/crates/fluvio-sc-schema/src/objects/watch.rs +++ b/crates/fluvio-sc-schema/src/objects/watch.rs @@ -56,6 +56,7 @@ where impl Request for ObjectApiWatchRequest { const API_KEY: u16 = AdminPublicApiKey::Watch as u16; + const MIN_API_VERSION: i16 = 15; const DEFAULT_API_VERSION: i16 = COMMON_VERSION; type Response = ObjectApiWatchResponse; } diff --git a/makefiles/test.mk b/makefiles/test.mk index baf9cf31e0..015523090c 100644 --- a/makefiles/test.mk +++ b/makefiles/test.mk @@ -214,6 +214,9 @@ longevity-test: build-test $(TEST_BIN) longevity --expect-timeout -- $(VERBOSE_FLAG) --runtime-seconds=60 endif +cli-backward-compatibility-test: + ./tests/cli/cli-backward-compatibility.bash + cli-platform-cross-version-test: bats -t ./tests/cli/cli-platform-cross-version.bats diff --git a/tests/cli/cli-backward-compatibility.bash b/tests/cli/cli-backward-compatibility.bash new file mode 100755 index 0000000000..f5f416d993 --- /dev/null +++ b/tests/cli/cli-backward-compatibility.bash @@ -0,0 +1,39 @@ +#!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status + +# Set the repository owner and name +OWNER="infinyon" +REPO="fluvio" + +# The oldest version we want to test backward compatibility with +BACKWARD_SINCE_VERSION="0.11.10" + +# Fetch releases using GitHub API +response=$(curl -s "https://api.github.com/repos/$OWNER/$REPO/releases") + +# Check if the response is empty or an error occurred +if [ -z "$response" ]; then + echo "Failed to fetch releases." + exit 1 +fi + +# Filter only non-prerelease releases +versions=$(echo "$response" | jq -r '.[] | select(.prerelease == false) | .tag_name') + +for version in $versions; do + # remove v prefix + version=$(echo $version | sed 's/v//') + echo "Running tests for version: $version" + + # Install current version on the cluster + $FLUVIO_BIN cluster start + # Install old version of the CLI + curl -fsS https://hub.infinyon.cloud/install/install.sh?ctx=ci | VERSION=$version bash + # Run the tests + CLI_VERSION=$version SKIP_SETUP=true CI=false make cli-platform-cross-version-test + + # Check if we have reached the version we want to stop at + if [[ $version == $BACKWARD_SINCE_VERSION ]]; then + break + fi +done diff --git a/tests/cli/cli-platform-cross-version.bats b/tests/cli/cli-platform-cross-version.bats index ac9300d239..7d0457e934 100644 --- a/tests/cli/cli-platform-cross-version.bats +++ b/tests/cli/cli-platform-cross-version.bats @@ -14,6 +14,9 @@ setup_file() { CLI_VERSION="${CLI_VERSION:-latest}" export CLI_VERSION + + FLUVIO_CLIENT_BIN="${FLUVIO_CLIENT_BIN:-$HOME/.fvm/versions/$CLI_VERSION/fluvio}" + export FLUVIO_CLIENT_BIN PAYLOAD_SIZE="${PAYLOAD_SIZE:-100}" export PAYLOAD_SIZE @@ -34,7 +37,7 @@ setup_file() { if [[ -z "$CI" ]]; then echo "# Deleting cluster" >&3 - "$FLUVIO_BIN" cluster delete --force" + "$FLUVIO_BIN" cluster delete --force else echo "# [CI MODE] Skipping initial cleanup" >&3 fi; @@ -57,24 +60,22 @@ teardown_file() { if [[ -z "$SKIP_CLEANUP" ]]; then echo "# Deleting cluster" >&3 - "$FLUVIO_BIN" cluster delete --force" + "$FLUVIO_BIN" cluster delete --force else echo "# Skipping cleanup" >&3 fi - - #run timeout 15s "$FLUVIO_BIN" topic delete "$TOPIC_NAME" } # Create topic @test "Create a topic: $TOPIC_NAME" { debug_msg "topic: $TOPIC_NAME" - run timeout 15s "$FLUVIO_BIN" topic create "$TOPIC_NAME" + run timeout 15s "$FLUVIO_CLIENT_BIN" topic create "$TOPIC_NAME" assert_success } # Produce message @test "Produce message" { - run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME"' + run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_CLIENT_BIN" produce "$TOPIC_NAME"' assert_success } @@ -82,7 +83,7 @@ teardown_file() { # Consume message and compare message # Warning: Adding anything extra to the `debug_msg` skews the message comparison @test "Consume message" { - run timeout 15s "$FLUVIO_BIN" consume "$TOPIC_NAME" -B -d + run timeout 15s "$FLUVIO_CLIENT_BIN" consume "$TOPIC_NAME" -B -d assert_output --partial "$MESSAGE" assert_success diff --git a/tests/cli/test_helper/fluvio_dev.bash b/tests/cli/test_helper/fluvio_dev.bash index cc9f0009d4..8a762938dd 100644 --- a/tests/cli/test_helper/fluvio_dev.bash +++ b/tests/cli/test_helper/fluvio_dev.bash @@ -74,5 +74,5 @@ function setup_fluvio_cli() { CLI_VERSION=${1:-latest} echo "Installing CLI @ VERSION: $CLI_VERSION" >&3 curl -fsS https://hub.infinyon.cloud/install/install.sh?ctx=ci | VERSION=$CLI_VERSION bash - $FLUVIO_BIN version >&3 + $HOME/.fvm/versions/$CLI_VERSION/fluvio version >&3 }