This is an automated email from the ASF dual-hosted git repository.

hubcio pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 801b152a5 test(bdd): run Rust BDD against iggy-server-ng with VSR 
(#3732)
801b152a5 is described below

commit 801b152a56425dccd88ce33f6e3163df33d81f6d
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Thu Jul 23 12:26:12 2026 +0200

    test(bdd): run Rust BDD against iggy-server-ng with VSR (#3732)
---
 .dockerignore                   |  1 +
 .github/config/components.yml   |  3 +-
 .github/workflows/_test_bdd.yml | 37 ++++++++++++-----
 bdd/README.md                   | 10 +++++
 bdd/docker-compose.coverage.yml |  6 +--
 bdd/docker-compose.vsr.yml      | 88 +++++++++++++++++++++++++++++++++++++++++
 bdd/docker-compose.yml          |  9 +++--
 bdd/rust/Cargo.toml             |  1 +
 core/server-ng/Cargo.toml       |  1 +
 scripts/run-bdd-tests.sh        | 27 ++++++++++++-
 10 files changed, 165 insertions(+), 18 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index 02100b387..b527cb132 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -25,6 +25,7 @@
 /target
 !/target/debug/iggy
 !/target/debug/iggy-server
+!/target/debug/iggy-server-ng
 !/target/debug/iggy-mcp
 !/target/debug/iggy-connectors
 /web/node_modules
diff --git a/.github/config/components.yml b/.github/config/components.yml
index d6c18a477..2d30025cb 100644
--- a/.github/config/components.yml
+++ b/.github/config/components.yml
@@ -300,6 +300,7 @@ components:
       - "bdd/docker-compose.server.yml"
       - "bdd/docker-compose.cluster.yml"
       - "bdd/docker-compose.coverage.yml"
+      - "bdd/docker-compose.vsr.yml"
 
   # Individual BDD tests per SDK - only run when specific SDK changes
   bdd-rust:
@@ -311,7 +312,7 @@ components:
     paths:
       - "bdd/rust/**"
       - "bdd/scenarios/**"
-    tasks: ["bdd-rust"]
+    tasks: ["bdd-rust", "bdd-rust-vsr"]
 
   bdd-python:
     depends_on:
diff --git a/.github/workflows/_test_bdd.yml b/.github/workflows/_test_bdd.yml
index f0b566a3d..cc22d1f19 100644
--- a/.github/workflows/_test_bdd.yml
+++ b/.github/workflows/_test_bdd.yml
@@ -51,18 +51,28 @@ jobs:
       - name: Build server for BDD tests
         if: startsWith(inputs.component, 'bdd-') && startsWith(inputs.task, 
'bdd-')
         run: |
-          echo "Building server binary and CLI for BDD tests..."
-          cargo build --locked --bin iggy-server --bin iggy
+          if [ "${{ inputs.task }}" = "bdd-rust-vsr" ]; then
+            # server-ng lane: the vsr feature must be enabled on both the
+            # server and the CLI, otherwise the CLI cannot frame requests
+            # for the VSR wire protocol (healthcheck ping would fail).
+            SERVER_BIN="iggy-server-ng"
+            echo "Building server-ng binary and CLI (--features vsr) for BDD 
tests..."
+            cargo build --locked --bin iggy-server-ng --bin iggy --features vsr
+          else
+            SERVER_BIN="iggy-server"
+            echo "Building server binary and CLI for BDD tests..."
+            cargo build --locked --bin iggy-server --bin iggy
+          fi
 
-          echo "Server binary built at: target/debug/iggy-server"
-          ls -lh target/debug/iggy-server
+          echo "Server binary built at: target/debug/${SERVER_BIN}"
+          ls -lh "target/debug/${SERVER_BIN}"
 
           echo "CLI binary built at: target/debug/iggy"
           ls -lh target/debug/iggy
 
           # Verify the binary exists and is executable
-          if [ ! -f "target/debug/iggy-server" ]; then
-            echo "ERROR: Server binary not found at target/debug/iggy-server"
+          if [ ! -f "target/debug/${SERVER_BIN}" ]; then
+            echo "ERROR: Server binary not found at target/debug/${SERVER_BIN}"
             exit 1
           fi
 
@@ -74,12 +84,21 @@ jobs:
       - name: Run BDD tests
         if: startsWith(inputs.component, 'bdd-') && startsWith(inputs.task, 
'bdd-')
         run: |
-          # Extract SDK name from task (format: bdd-<sdk>)
+          # Extract SDK name from task (format: bdd-<sdk>, or bdd-<sdk>-vsr
+          # for the server-ng lane)
           SDK_NAME=$(echo "${{ inputs.task }}" | sed 's/^bdd-//')
+          EXTRA_FLAGS=()
+          if [ "$SDK_NAME" = "rust-vsr" ]; then
+            SDK_NAME="rust"
+            EXTRA_FLAGS+=(--vsr)
+            export IGGY_SERVER_NG_PATH="target/debug/iggy-server-ng"
+            echo "Server binary location: $(ls -lh 
target/debug/iggy-server-ng)"
+          else
+            echo "Server binary location: $(ls -lh target/debug/iggy-server)"
+          fi
 
           echo "Running BDD tests for SDK: $SDK_NAME"
           echo "Current directory: $(pwd)"
-          echo "Server binary location: $(ls -lh target/debug/iggy-server)"
           echo "CLI binary location: $(ls -lh target/debug/iggy)"
 
           # Export path to the pre-built server and cli binaries (relative to 
repo root)
@@ -87,7 +106,7 @@ jobs:
           export IGGY_CLI_PATH="target/debug/iggy"
           export IGGY_ROOT_USERNAME="iggy"
           export IGGY_ROOT_PASSWORD="iggy"
-          ./scripts/run-bdd-tests.sh "$SDK_NAME"
+          ./scripts/run-bdd-tests.sh "${EXTRA_FLAGS[@]}" "$SDK_NAME"
 
       - name: Clean up Docker resources (BDD)
         if: always() && startsWith(inputs.component, 'bdd-') && 
startsWith(inputs.task, 'bdd-')
diff --git a/bdd/README.md b/bdd/README.md
index a17bbc950..2509006f4 100644
--- a/bdd/README.md
+++ b/bdd/README.md
@@ -39,6 +39,7 @@ bdd/
 ├── docker-compose.server.yml   # Single iggy-server test setup
 ├── docker-compose.cluster.yml  # Leader + follower test setup
 ├── docker-compose.coverage.yml # Coverage collection overlay
+├── docker-compose.vsr.yml      # server-ng (VSR) overlay, Rust SDK only
 ├── Dockerfile                  # Debug build of Iggy server
 └── README.md
 ```
@@ -70,6 +71,15 @@ bdd/
 # Run only leader_redirection
 ../scripts/run-bdd-tests.sh all leader_redirection
 
+# Run against iggy-server-ng with VSR (Rust SDK only; other SDKs do not
+# speak the VSR wire protocol yet). Build the vsr binaries first:
+#   cargo build --bin iggy-server-ng --bin iggy --features vsr
+# NOTE: `target/debug/iggy` is shared between lanes and the vsr flavour
+# speaks a different wire protocol. When switching back to the legacy
+# lane, rebuild without `--features vsr` first, or the in-container
+# healthcheck ping cannot talk to the legacy server.
+../scripts/run-bdd-tests.sh --vsr rust
+
 # Clean up Docker resources
 ../scripts/run-bdd-tests.sh clean
 ```
diff --git a/bdd/docker-compose.coverage.yml b/bdd/docker-compose.coverage.yml
index dfc47984a..b7732bf1a 100644
--- a/bdd/docker-compose.coverage.yml
+++ b/bdd/docker-compose.coverage.yml
@@ -32,9 +32,9 @@ services:
         rustup component add llvm-tools-preview \
         && cargo install cargo-llvm-cov \
         && case "$$BDD_FEATURE" in
-          basic_messaging)    cargo llvm-cov test -p bdd --features bdd --test 
basic_messaging --lcov --output-path /reports/rust-bdd-coverage.lcov ;;
-          leader_redirection) cargo llvm-cov test -p bdd --features bdd --test 
leader_redirection --lcov --output-path /reports/rust-bdd-coverage.lcov ;;
-          *)                  cargo llvm-cov test -p bdd --features bdd --lcov 
--output-path /reports/rust-bdd-coverage.lcov ;;
+          basic_messaging)    cargo llvm-cov test -p bdd --features 
"$$BDD_RUST_FEATURES" --test basic_messaging --lcov --output-path 
/reports/rust-bdd-coverage.lcov ;;
+          leader_redirection) cargo llvm-cov test -p bdd --features 
"$$BDD_RUST_FEATURES" --test leader_redirection --lcov --output-path 
/reports/rust-bdd-coverage.lcov ;;
+          *)                  cargo llvm-cov test -p bdd --features 
"$$BDD_RUST_FEATURES" --lcov --output-path /reports/rust-bdd-coverage.lcov ;;
         esac
 
   python-bdd:
diff --git a/bdd/docker-compose.vsr.yml b/bdd/docker-compose.vsr.yml
new file mode 100644
index 000000000..15d6ef1ed
--- /dev/null
+++ b/bdd/docker-compose.vsr.yml
@@ -0,0 +1,88 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# server-ng (VSR) override. Swaps the legacy iggy-server binary for
+# iggy-server-ng built with `--features vsr` and adapts args, credentials,
+# and cluster topology to server-ng semantics:
+#   - server-ng takes no `--fresh` / `--with-default-root-credentials` /
+#     `--follower` flags; the only CLI arg is `--replica-id <N>`.
+#   - Root credentials come from IGGY_ROOT_USERNAME / IGGY_ROOT_PASSWORD
+#     (mandatory when the cluster is enabled).
+#   - `cluster.nodes[*].ip` is parsed as a strict IpAddr (no hostnames)
+#     and cluster listeners bind to that roster IP, so nodes get static
+#     IPs and node healthchecks ping the roster address, not loopback.
+#   - Replica-to-replica consensus requires `ports.tcp_replica`.
+# The leader_redirection feature runs a REAL 2-node VSR cluster here
+# (initial leader = replica 0), not the legacy mock `--follower` server.
+#
+# Activated by: ./scripts/run-bdd-tests.sh --vsr rust [feature]
+# Must be passed LAST so its overrides win over the server/cluster files.
+
+x-server-ng-image: &server-ng-image
+  image: iggy-bdd-server-ng
+  build:
+    context: ..
+    dockerfile: core/server-ng/Dockerfile
+    target: runtime-prebuilt
+    args:
+      PREBUILT_IGGY_SERVER_NG: 
${IGGY_SERVER_NG_PATH:-target/debug/iggy-server-ng}
+      PREBUILT_IGGY_CLI: ${IGGY_CLI_PATH:-target/debug/iggy}
+
+x-vsr-cluster-env: &vsr-cluster-env
+  IGGY_ROOT_USERNAME: iggy
+  IGGY_ROOT_PASSWORD: iggy
+  IGGY_CLUSTER_NODES_0_IP: 172.28.0.101
+  IGGY_CLUSTER_NODES_1_IP: 172.28.0.102
+  IGGY_CLUSTER_NODES_0_PORTS_TCP_REPLICA: "8191"
+  IGGY_CLUSTER_NODES_1_PORTS_TCP_REPLICA: "8192"
+
+services:
+  iggy-server:
+    <<: *server-ng-image
+    command: []
+    environment:
+      - IGGY_ROOT_USERNAME=iggy
+      - IGGY_ROOT_PASSWORD=iggy
+
+  iggy-leader:
+    <<: *server-ng-image
+    command: [ "--replica-id", "0" ]
+    environment:
+      <<: *vsr-cluster-env
+    networks:
+      iggy-bdd-network:
+        ipv4_address: 172.28.0.101
+    healthcheck:
+      test: [ "CMD", "/usr/local/bin/iggy", "--tcp-server-address", 
"172.28.0.101:8091", "ping" ]
+
+  iggy-follower:
+    <<: *server-ng-image
+    command: [ "--replica-id", "1" ]
+    environment:
+      <<: *vsr-cluster-env
+    networks:
+      iggy-bdd-network:
+        ipv4_address: 172.28.0.102
+    healthcheck:
+      test: [ "CMD", "/usr/local/bin/iggy", "--tcp-server-address", 
"172.28.0.102:8092", "ping" ]
+
+networks:
+  iggy-bdd-network:
+    driver: bridge
+    ipam:
+      config:
+        - subnet: 172.28.0.0/24
diff --git a/bdd/docker-compose.yml b/bdd/docker-compose.yml
index 2b9c7b23f..8a103db89 100644
--- a/bdd/docker-compose.yml
+++ b/bdd/docker-compose.yml
@@ -25,6 +25,7 @@ services:
       - IGGY_ROOT_USERNAME=iggy
       - IGGY_ROOT_PASSWORD=iggy
       - BDD_FEATURE=${BDD_FEATURE:-all}
+      - BDD_RUST_FEATURES=${BDD_RUST_FEATURES:-bdd}
       - RUST_LOG=debug
       - RUSTFLAGS=-C linker=gcc
     volumes:
@@ -36,10 +37,10 @@ services:
       - -c
       - |
         case "$$BDD_FEATURE" in
-          basic_messaging)    cargo test -p bdd --features bdd --test 
basic_messaging ;;
-          leader_redirection) cargo test -p bdd --features bdd --test 
leader_redirection ;;
-          raw_command)        cargo test -p bdd --features bdd --test 
raw_command ;;
-          *)                  cargo test -p bdd --features bdd ;;
+          basic_messaging)    cargo test -p bdd --features 
"$$BDD_RUST_FEATURES" --test basic_messaging ;;
+          leader_redirection) cargo test -p bdd --features 
"$$BDD_RUST_FEATURES" --test leader_redirection ;;
+          raw_command)        cargo test -p bdd --features 
"$$BDD_RUST_FEATURES" --test raw_command ;;
+          *)                  cargo test -p bdd --features 
"$$BDD_RUST_FEATURES" ;;
         esac
     networks:
       - iggy-bdd-network
diff --git a/bdd/rust/Cargo.toml b/bdd/rust/Cargo.toml
index 0b761fb42..f63ac4564 100644
--- a/bdd/rust/Cargo.toml
+++ b/bdd/rust/Cargo.toml
@@ -25,6 +25,7 @@ publish = false
 
 [features]
 bdd = []
+vsr = ["iggy/vsr"]
 
 [dev-dependencies]
 bytes = { workspace = true }
diff --git a/core/server-ng/Cargo.toml b/core/server-ng/Cargo.toml
index 624caf903..558504dbc 100644
--- a/core/server-ng/Cargo.toml
+++ b/core/server-ng/Cargo.toml
@@ -88,6 +88,7 @@ default = ["mimalloc", "iggy-web"]
 disable-mimalloc = []
 mimalloc = ["dep:mimalloc"]
 iggy-web = ["dep:rust-embed", "dep:mime_guess"]
+vsr = ["iggy_common/vsr"]
 
 [dependencies]
 ahash = { workspace = true }
diff --git a/scripts/run-bdd-tests.sh b/scripts/run-bdd-tests.sh
index 29e0124d9..cb86d7b8b 100755
--- a/scripts/run-bdd-tests.sh
+++ b/scripts/run-bdd-tests.sh
@@ -19,10 +19,12 @@
 set -Eeuo pipefail
 
 COVERAGE=0
+VSR=0
 ARGS=()
 for arg in "$@"; do
   case "$arg" in
     --coverage) COVERAGE=1 ;;
+    --vsr) VSR=1 ;;
     *) ARGS+=("$arg") ;;
   esac
 done
@@ -33,18 +35,32 @@ FEATURE="${ARGS[1]:-all}"
 log(){ printf "%b\n" "$*"; }
 
 usage(){
-  log "Usage: $0 [--coverage] <sdk> [feature]"
+  log "Usage: $0 [--coverage] [--vsr] <sdk> [feature]"
   log ""
   log "  sdk:     rust | python | php | go | go-race | node | csharp | java | 
cpp | all | clean (default: all)"
   log "  feature: basic_messaging | leader_redirection | raw_command | all  
(default: all)"
+  log "  --vsr:   run against iggy-server-ng built with --features vsr (rust 
only);"
+  log "           expects IGGY_SERVER_NG_PATH (default: 
target/debug/iggy-server-ng)"
+  log "           and a vsr-built iggy CLI at IGGY_CLI_PATH"
   log ""
   log "Examples:"
   log "  $0 rust                         # run all features for Rust"
   log "  $0 rust basic_messaging         # run only basic_messaging for Rust"
   log "  $0 all leader_redirection       # run leader_redirection for all 
supporting SDKs"
+  log "  $0 --vsr rust                   # run all features for Rust against 
server-ng"
   log "  $0 --coverage go basic_messaging"
 }
 
+if [ "$VSR" = "1" ]; then
+  case "$SDK" in
+    rust|clean) ;;
+    *)
+      log "❌ --vsr supports only the Rust SDK (server-ng speaks the VSR wire 
protocol)"
+      usage
+      exit 2 ;;
+  esac
+fi
+
 case "$FEATURE" in
   basic_messaging|leader_redirection|raw_command|all) ;;
   *)
@@ -62,6 +78,7 @@ ALL_COMPOSE_FILES=(
   -f docker-compose.server.yml
   -f docker-compose.cluster.yml
   -f docker-compose.coverage.yml
+  -f docker-compose.vsr.yml
 )
 
 COMPOSE_FILES=(-f docker-compose.yml)
@@ -77,6 +94,11 @@ if [ "$COVERAGE" = "1" ]; then
   COMPOSE_FILES+=(-f docker-compose.coverage.yml)
   mkdir -p ../reports
 fi
+# vsr overrides must come last to win over the server/cluster/coverage files.
+if [ "$VSR" = "1" ]; then
+  COMPOSE_FILES+=(-f docker-compose.vsr.yml)
+  export BDD_RUST_FEATURES="bdd,vsr"
+fi
 
 cleanup(){
   log "🧹  cleaning up containers & volumes…"
@@ -86,6 +108,9 @@ trap cleanup EXIT INT TERM
 
 log "🧪 Running BDD tests for SDK: ${SDK}"
 log "📁 Feature file: ${FEATURE}"
+if [ "$VSR" = "1" ]; then
+  log "🗳️ Server: iggy-server-ng (--features vsr)"
+fi
 if [ "$COVERAGE" = "1" ]; then
   log "📊 Coverage collection enabled → reports will be in ./reports/"
 fi

Reply via email to