This is an automated email from the ASF dual-hosted git repository. spetz pushed a commit to branch go_sdk_vsr in repository https://gitbox.apache.org/repos/asf/iggy.git
commit ade1e65f5e708be7ef06dddf7fd562621afbf01e Merge: 4d6506b6d 02c24b399 Author: spetz <[email protected]> AuthorDate: Fri Aug 7 20:45:32 2026 +0200 Resolve conflicts, add missing Node VSR tests to CI .../actions/python-maturin/pre-merge/action.yml | 42 ++++++++++++---------- .github/config/components.yml | 2 +- .github/workflows/_test_bdd.yml | 19 +++++----- .github/workflows/_test_examples.yml | 13 +++---- .github/workflows/coverage-baseline.yml | 21 +++++++++++ bdd/docker-compose.vsr.yml | 8 ++++- .../tests/server/topic_admission_vsr.rs | 20 ++++++++++- core/server-ng/src/responses.rs | 6 ++-- foreign/node/src/bdd/auth.ts | 3 ++ foreign/python/Cargo.toml | 4 ++- foreign/python/tests/test_message_operations.py | 17 ++++----- foreign/python/tests/test_tls.py | 11 ++++-- foreign/python/tests/test_topic.py | 18 +++++----- foreign/python/tests/utils.py | 33 ++++++++++++++++- scripts/run-bdd-tests.sh | 6 ++-- scripts/run-examples-from-readme.sh | 11 ++++-- scripts/utils.sh | 11 +++--- 17 files changed, 176 insertions(+), 69 deletions(-) diff --cc .github/config/components.yml index 7b427500e,a2ec096d5..0f140ad71 --- a/.github/config/components.yml +++ b/.github/config/components.yml @@@ -370,7 -360,7 +370,7 @@@ components paths: - "bdd/node/**" - "bdd/scenarios/**" -- tasks: ["bdd-node"] ++ tasks: ["bdd-node", "bdd-node-vsr"] bdd-csharp: depends_on: diff --cc .github/workflows/_test_bdd.yml index 59367809e,17258cf18..5640e1bbb --- a/.github/workflows/_test_bdd.yml +++ b/.github/workflows/_test_bdd.yml @@@ -51,15 -51,15 +51,16 @@@ jobs - name: Build server for BDD tests if: startsWith(inputs.component, 'bdd-') && startsWith(inputs.task, 'bdd-') run: | - case "${{ inputs.task }}" in bdd-rust-vsr|bdd-python) - # vsr lane: the 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). - # Python wheels are vsr-built, so the whole lane runs vsr. - # TODO(hubcio): change to iggy-server once legacy server is - # removed (core/server has VSR support) + # The VSR lanes need the vsr feature on both the server and the CLI, + # otherwise the CLI cannot frame requests for the VSR wire protocol - # and the healthcheck ping fails. The Go SDK speaks only VSR, so its - # suites are always on this branch. ++ # and the healthcheck ping fails. The Go SDK speaks only VSR and the ++ # Python wheels are vsr-built, so those suites are always on this ++ # branch. + case "${{ inputs.task }}" in - bdd-rust-vsr|bdd-go|bdd-go-race) ++ bdd-rust-vsr|bdd-go|bdd-go-race|bdd-python|bdd-node-vsr) + # TODO: change to iggy-server once legacy server is removed (core/server has VSR support) SERVER_BIN="iggy-server-ng" - echo "Building server binary and CLI (--features vsr) for BDD tests..." + echo "Building the VSR server binary and CLI (--features vsr) for BDD tests..." cargo build --locked --bin iggy-server-ng --bin iggy --features vsr ;; *) @@@ -90,20 -90,14 +91,20 @@@ if: startsWith(inputs.component, 'bdd-') && startsWith(inputs.task, 'bdd-') run: | # 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-//') + # for an explicit vsr lane). Python has no legacy lane, so its + # plain task name runs vsr. + SDK_NAME=$(echo "${{ inputs.task }}" | sed 's/^bdd-//; s/-vsr$//') EXTRA_FLAGS=() - case "$SDK_NAME" in - rust-vsr) - SDK_NAME="rust" - case "${{ inputs.task }}" in bdd-rust-vsr|bdd-python) ++ case "${{ inputs.task }}" in ++ bdd-rust-vsr|bdd-python|bdd-node-vsr) EXTRA_FLAGS+=(--vsr) - # TODO(hubcio): change to iggy-server once legacy server is - # removed (core/server has VSR support) + # TODO: change to iggy-server once legacy server is removed (core/server has VSR support) + export IGGY_SERVER_NG_PATH="target/debug/iggy-server-ng" + echo "Server binary location: $(ls -lh target/debug/iggy-server-ng)" + ;; - go|go-race) ++ bdd-go|bdd-go-race) + # The Go SDK speaks only VSR, so the runner forces the overlay. + # TODO: change to iggy-server once legacy server is removed (core/server has VSR support) export IGGY_SERVER_NG_PATH="target/debug/iggy-server-ng" echo "Server binary location: $(ls -lh target/debug/iggy-server-ng)" ;; diff --cc .github/workflows/_test_examples.yml index f93ae575b,2335aa325..3fdb10474 --- a/.github/workflows/_test_examples.yml +++ b/.github/workflows/_test_examples.yml @@@ -113,14 -113,15 +113,15 @@@ jobs echo "Building common binaries for all examples tests..." echo "Current directory: $(pwd)" - # The Go SDK speaks only the VSR wire protocol, so its lane needs the - # VSR server. Every other language still runs against the legacy one - # until its own migration lands. - if [[ "${{ inputs.task }}" == "examples-go" ]]; then - # Python wheels are vsr-built, so the Python examples run - # against the vsr server; every other language still runs - # against the legacy server. - if [[ "${{ inputs.task }}" == "examples-python" ]]; then - # TODO(hubcio): change to iggy-server once legacy server is - # removed (core/server has VSR support) ++ # The Go SDK speaks only the VSR wire protocol and the Python wheels ++ # are vsr-built, so those lanes need the VSR server. Every other ++ # language still runs against the legacy one until its own migration ++ # lands. ++ if [[ "${{ inputs.task }}" == "examples-go" || "${{ inputs.task }}" == "examples-python" ]]; then + # TODO: change to iggy-server once legacy server is removed (core/server has VSR support) SERVER_BIN="iggy-server-ng" echo "Building ${SERVER_BIN} (--features vsr)..." - cargo build --locked --bin iggy-server-ng --features vsr + cargo build --locked --bin "${SERVER_BIN}" --features vsr else SERVER_BIN="iggy-server" echo "Building ${SERVER_BIN}..." diff --cc bdd/docker-compose.vsr.yml index af414d60b,af414d60b..9aaf51d37 --- a/bdd/docker-compose.vsr.yml +++ b/bdd/docker-compose.vsr.yml @@@ -29,7 -29,7 +29,7 @@@ # 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] ++# Activated by: ./scripts/run-bdd-tests.sh --vsr <sdk> [feature] # Must be passed LAST so its overrides win over the server/cluster files. x-server-ng-image: &server-ng-image @@@ -65,6 -65,6 +65,12 @@@ services - IGGY_ROOT_USERNAME=iggy - IGGY_ROOT_PASSWORD=iggy ++ # The Node SDK picks the wire protocol at runtime; classic is its default, ++ # so the VSR lane has to opt in explicitly. ++ node-bdd: ++ environment: ++ - IGGY_TEST_PROTOCOL=vsr ++ iggy-leader: <<: *server-ng-image command: [ "--replica-id", "0" ] diff --cc foreign/node/src/bdd/auth.ts index 147327ee1,147327ee1..a67e49692 --- a/foreign/node/src/bdd/auth.ts +++ b/foreign/node/src/bdd/auth.ts @@@ -18,14 -18,14 +18,17 @@@ import assert from 'node:assert/strict'; import { Client } from '../client/index.js'; ++import type { Protocol } from '../client/index.js'; import { Given } from "@cucumber/cucumber"; import type { TestWorld } from './world.js'; import { getIggyAddress } from '../tcp.sm.utils.js'; const credentials = { username: 'iggy', password: 'iggy' }; const [host, port] = getIggyAddress(); ++const protocol: Protocol = process.env.IGGY_TEST_PROTOCOL === 'vsr' ? 'vsr' : 'classic'; const opt = { ++ protocol, transport: 'TCP' as const, options: { host, port }, credentials diff --cc scripts/run-bdd-tests.sh index f37883f48,bbad9f710..37d47315a --- a/scripts/run-bdd-tests.sh +++ b/scripts/run-bdd-tests.sh @@@ -39,11 -39,11 +39,11 @@@ usage() 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 and go);" - # TODO(hubcio): change to iggy-server once legacy server is removed - # (core/server has VSR support) - log " --vsr: run against iggy-server-ng built with --features vsr (rust and python);" + # TODO: change to iggy-server once legacy server is removed (core/server has VSR support) ++ log " --vsr: run against iggy-server-ng built with --features vsr (rust, python, go, node);" log " expects IGGY_SERVER_NG_PATH (default: target/debug/iggy-server-ng)" - log " and a vsr-built iggy CLI at IGGY_CLI_PATH" + log " and a vsr-built iggy CLI at IGGY_CLI_PATH." + log " The go suites imply it: the Go SDK speaks only the VSR protocol." log "" log "Examples:" log " $0 rust # run all features for Rust" @@@ -55,9 -55,9 +55,9 @@@ if [ "$VSR" = "1" ]; then case "$SDK" in - rust|go|go-race|clean) ;; - rust|python|clean) ;; ++ rust|python|go|go-race|node|clean) ;; *) - log "❌ --vsr supports only the Rust and Go SDKs so far" - log "❌ --vsr supports only the Rust and Python SDKs (server-ng speaks the VSR wire protocol)" ++ log "❌ --vsr supports only the Rust, Python, Go, and Node SDKs so far" usage exit 2 ;; esac diff --cc scripts/utils.sh index 72257166a,2e45d756a..fb84c8b6a --- a/scripts/utils.sh +++ b/scripts/utils.sh @@@ -159,17 -159,17 +159,19 @@@ readonly EXAMPLES_SERVER_TIMEOUT=30 readonly EXAMPLES_STOP_TIMEOUT=5 # Resolve and validate the server binary path. -# Usage: resolve_server_binary [target] [binary-name] -# Sets global SERVER_BIN. binary-name defaults to iggy-server; vsr lanes -# pass their server binary (built with --features vsr so the wire -# protocol matches vsr-built clients). +# Usage: resolve_server_binary [target] [binary_name] [cargo_features] - # Sets global SERVER_BIN. ++# Sets global SERVER_BIN. binary_name defaults to iggy-server; vsr lanes ++# pass their server binary and the vsr feature (so the wire protocol ++# matches vsr-built clients). function resolve_server_binary() { local target="${1:-}" - local binary_name="${2:-iggy-server}" + local binary="${2:-iggy-server}" + local features="${3:-}" + if [ -n "${target}" ]; then - SERVER_BIN="target/${target}/debug/${binary_name}" + SERVER_BIN="target/${target}/debug/${binary}" else - SERVER_BIN="target/debug/${binary_name}" + SERVER_BIN="target/debug/${binary}" fi if [ ! -f "${SERVER_BIN}" ]; then @@@ -239,33 -236,9 +241,34 @@@ function start_tls_server() echo $! >"${EXAMPLES_PID_FILE}" } -# Block until the server logs readiness or timeout. Matches both the -# legacy line ("has started") and the vsr server line ("client -# listeners started", logged once the TCP socket is bound). +# How wait_for_server_ready decides the server is up. "log" greps the startup - # line. "tcp" polls the listener instead, which is what a lane running the VSR - # server needs: it prints no such line. ++# lines: the legacy "has started" and the VSR server "client listeners ++# started" (logged once the TCP socket is bound). "tcp" polls the listener ++# instead for lanes that cannot rely on a startup line. +: "${SERVER_READY_PROBE:=log}" +: "${SERVER_READY_ADDRESS:=127.0.0.1:8090}" + +# Report whether the server is accepting work. +function server_is_ready() { + if [ "${SERVER_READY_PROBE}" = "tcp" ]; then + local host="${SERVER_READY_ADDRESS%:*}" + local port="${SERVER_READY_ADDRESS##*:}" + (exec 3<>"/dev/tcp/${host}/${port}") 2>/dev/null || return 1 + exec 3<&- + return 0 + fi - grep -q "has started" "${EXAMPLES_LOG_FILE}" ++ grep -qE "has started|client listeners started" "${EXAMPLES_LOG_FILE}" +} + +# Report whether the server this script started is still running. +function server_is_alive() { + local pid + pid="$(cat "${EXAMPLES_PID_FILE}" 2>/dev/null)" || return 0 + [ -n "${pid}" ] || return 0 + kill -0 "${pid}" 2>/dev/null +} + +# Block until the server is ready or the timeout elapses. # Usage: wait_for_server_ready [label] function wait_for_server_ready() { local label="${1:-Iggy}"
