diff --git a/test/tap/tests/test_mcp_claude_headless_flow-t.sh b/test/tap/tests/test_mcp_claude_headless_flow-t.sh index 968f24998..1e8cdafc6 100755 --- a/test/tap/tests/test_mcp_claude_headless_flow-t.sh +++ b/test/tap/tests/test_mcp_claude_headless_flow-t.sh @@ -14,12 +14,13 @@ PLAN=6 DONE=0 FAIL=0 -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" HEADLESS_DIR="${REPO_ROOT}/scripts/mcp/DiscoveryAgent/ClaudeCode_Headless" STATIC_HARVEST="${HEADLESS_DIR}/static_harvest.sh" TWO_PHASE="${HEADLESS_DIR}/two_phase_discovery.py" -TARGET_ID="${MCP_TARGET_ID:-tap_mysql_default}" +# Use actual target_id from local setup +TARGET_ID="${MCP_TARGET_ID:-mysql-127.0.0.1-13306}" SCHEMA_NAME="${TEST_DB_NAME:-testdb}" MCP_CONFIG_PATH="${TAP_CLAUDE_MCP_CONFIG:-${HEADLESS_DIR}/mcp_config.example.json}" RUN_REAL_CLAUDE="${TAP_RUN_REAL_CLAUDE:-0}" @@ -58,6 +59,20 @@ echo "msg: # can be invoked with proper MCP target configuration." echo "msg: # ===============================================" echo "msg: #" +# Enable MCP via Admin +echo "msg: # Enabling MCP and registering targets via Admin interface..." +mysql -u admin -padmin -h 127.0.0.1 -P 6032 <&1 || true)" +echo "msg: # Executing: ${STATIC_HARVEST} --endpoint ${ENDPOINT} --target-id ${TARGET_ID} --schema ${SCHEMA_NAME}" +static_out="$("${STATIC_HARVEST}" --endpoint "${ENDPOINT}" --target-id "${TARGET_ID}" --schema "${SCHEMA_NAME}" --notes "tap_claude_headless_flow" 2>&1 || true)" RUN_ID="$(echo "${static_out}" | sed -n 's/^Run ID:[[:space:]]*\([0-9][0-9]*\)$/\1/p' | head -n1)" if [[ -n "${RUN_ID}" ]]; then - tap_ok "static_harvest.sh returns run id" + tap_ok "static_harvest.sh returns run id: ${RUN_ID}" else tap_not_ok "static_harvest.sh returns run id" "${static_out}" fi +echo "msg: # Executing dry-run: python3 ${TWO_PHASE} --mcp-config ${MCP_CONFIG_PATH} --target-id ${TARGET_ID} --run-id ${RUN_ID} --dry-run" dry_out="$(python3 "${TWO_PHASE}" --mcp-config "${MCP_CONFIG_PATH}" --target-id "${TARGET_ID}" --schema "${SCHEMA_NAME}" --run-id "${RUN_ID}" --dry-run 2>&1 || true)" if echo "${dry_out}" | grep -q "\[DRY RUN\]" && echo "${dry_out}" | grep -q "Target ID: ${TARGET_ID}"; then tap_ok "two_phase_discovery.py dry-run includes target_id and succeeds"