From 16c0766a153c5bfe4ea877d7f6b8c597426c171e Mon Sep 17 00:00:00 2001 From: ryyst Date: Sat, 20 Sep 2025 19:03:15 +0300 Subject: [PATCH] improve: add robust retry logic to conflict resolution test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the fixed 20-second wait with intelligent retry logic that: - Checks for convergence every 3 seconds for up to 60 seconds - Provides detailed progress logging showing current state - Reduces sync interval from 8s to 3s for faster testing - Adds 10-second cluster stabilization period This makes the test more reliable and provides better diagnostics when conflict resolution doesn't work as expected. The retry logic reveals that the current conflict resolution mechanism needs investigation, but the test infrastructure itself is now much more robust. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- integration_test.sh | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/integration_test.sh b/integration_test.sh index 22305cf..4197cf1 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -241,7 +241,7 @@ port: 8111 data_dir: "./conflict1_data" seed_nodes: [] log_level: "info" -sync_interval: 8 +sync_interval: 3 EOF cat > conflict2.yaml </dev/null) - local node2_final_msg=$(echo "$node2_final_full" | jq -r '.data.message' 2>/dev/null) + # Wait for conflict resolution with retry logic (up to 60 seconds) + local max_attempts=20 + local attempt=1 + local node1_final_msg="" + local node2_final_msg="" + local node1_final_full="" + local node2_final_full="" + + log_info "Waiting for conflict resolution (checking every 3 seconds, max 60 seconds)..." + + while [ $attempt -le $max_attempts ]; do + sleep 3 + + # Get current data from both nodes + node1_final_full=$(curl -s http://localhost:8111/kv/test/conflict/data) + node2_final_full=$(curl -s http://localhost:8112/kv/test/conflict/data) + + node1_final_msg=$(echo "$node1_final_full" | jq -r '.data.message' 2>/dev/null) + node2_final_msg=$(echo "$node2_final_full" | jq -r '.data.message' 2>/dev/null) + + # Check if they've converged + if [ "$node1_final_msg" = "$node2_final_msg" ] && [ -n "$node1_final_msg" ] && [ "$node1_final_msg" != "null" ]; then + log_info "Conflict resolution achieved after $((attempt * 3)) seconds" + break + fi + + log_info "Attempt $attempt/$max_attempts: Node1='$node1_final_msg', Node2='$node2_final_msg' (not converged yet)" + attempt=$((attempt + 1)) + done # Check if they converged if [ "$node1_final_msg" = "$node2_final_msg" ] && [ -n "$node1_final_msg" ]; then