Skip to content

Commit b46fb57

Browse files
committed
TAP MCP client: port PR5372 coverage to MCP profiles/target_id routing model
This commit ports the TAP MCP client test coverage from PR #5372 to the new MCP profiles architecture, replacing legacy direct backend variable assumptions with target/profile-based routing. What was updated: - Reworked test setup to use `mcp_target_profiles` + `mcp_auth_profiles` rather than legacy `mcp-mysql_*` config variables. - Updated MCP request payloads and helper flows to route via `target_id`. - Aligned assertions with profile-backed runtime behavior and removed obsolete expectations tied to static mysql host/user/password globals. Why this was needed: - The previous tests were written before MCP target/profile routing existed. - Without this update, TAP coverage would exercise deprecated paths and miss regressions in the current MCP execution model. Result: - Test suite now validates the same functional intent as PR #5372 but against the current profile-driven MCP routing implementation.
1 parent 67cb1b7 commit b46fb57

File tree

7 files changed

+1089
-8
lines changed

7 files changed

+1089
-8
lines changed

test/tap/groups/groups.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
"genai_embedding_rerank-t": [ "ai-g1" ],
260260
"genai_module-t": [ "ai-g1" ],
261261
"mcp_module-t": [ "ai-g1" ],
262+
"mcp_query_run_sql_readonly-t": [ "ai-g1" ],
262263
"nl2sql_integration-t": [ "ai-g1" ],
263264
"nl2sql_internal-t": [ "ai-g1" ],
264265
"nl2sql_model_selection-t": [ "ai-g1" ],

test/tap/tap/Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ utils_mysql8.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.s
5959
tap.o: tap.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a libcurl.so -lssl -lcrypto libcpp_dotenv.so
6060
$(CXX) -fPIC -c tap.cpp $(IDIRS) $(OPT)
6161

62-
libtap_mariadb.a: tap.o command_line.o utils_mariadb.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
63-
ar rcs libtap_mariadb.a tap.o command_line.o utils_mariadb.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
62+
mcp_client.o: mcp_client.cpp mcp_client.h libcurl.so
63+
$(CXX) -fPIC -c mcp_client.cpp $(IDIRS) $(OPT)
6464

65-
libtap_mysql57.a: tap.o command_line.o utils_mysql57.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
66-
ar rcs libtap_mysql57.a tap.o command_line.o utils_mysql57.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
65+
libtap_mariadb.a: tap.o command_line.o utils_mariadb.o mcp_client.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
66+
ar rcs libtap_mariadb.a tap.o command_line.o utils_mariadb.o mcp_client.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
6767

68-
libtap_mysql8.a: tap.o command_line.o utils_mysql8.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
69-
ar rcs libtap_mysql8.a tap.o command_line.o utils_mysql8.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
68+
libtap_mysql57.a: tap.o command_line.o utils_mysql57.o mcp_client.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
69+
ar rcs libtap_mysql57.a tap.o command_line.o utils_mysql57.o mcp_client.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
70+
71+
libtap_mysql8.a: tap.o command_line.o utils_mysql8.o mcp_client.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a
72+
ar rcs libtap_mysql8.a tap.o command_line.o utils_mysql8.o mcp_client.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo
7073

7174
libtap.so: libtap_mariadb.a cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so libre2.so
7275
$(CXX) -shared -o libtap.so -Wl,--whole-archive libtap_mariadb.a -Wl,--no-whole-archive $(LWGCOV)
@@ -123,4 +126,3 @@ cleanall: clean
123126
# Remove cpp-dotenv source directories (213MB)
124127
cd cpp-dotenv/static && rm -rf cpp-dotenv-*/ || true
125128
cd cpp-dotenv/dynamic && rm -rf cpp-dotenv-*/ || true
126-

test/tap/tap/command_line.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ CommandLine::~CommandLine() {
3939
free(admin_username);
4040
if (admin_password)
4141
free(admin_password);
42+
if (mcp_auth_token)
43+
free(mcp_auth_token);
4244

4345
if (mysql_host)
4446
free(mysql_host);
@@ -236,6 +238,20 @@ int CommandLine::getEnv() {
236238
replace_str_field(&this->admin_password, value);
237239
}
238240

241+
{
242+
// proxysql mcp connection
243+
value = getenv("TAP_MCP_PORT");
244+
if (value) {
245+
env_port = strtol(value, NULL, 10);
246+
if (env_port > 0 && env_port < 65536)
247+
mcp_port = env_port;
248+
}
249+
250+
value = getenv("TAP_MCP_AUTH_TOKEN");
251+
if (value)
252+
replace_str_field(&this->mcp_auth_token, value);
253+
}
254+
239255
{
240256
// mysql admin connection
241257
value = getenv("TAP_MYSQLHOST");

test/tap/tap/command_line.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class CommandLine {
3232
char* admin_username = strdup("admin");
3333
char* admin_password = strdup("admin");
3434

35+
// proxysql mcp connection
36+
int mcp_port = 6071;
37+
char* mcp_auth_token = strdup("");
38+
3539
// mysql admin connection
3640
char* mysql_host = strdup("127.0.0.1");
3741
int mysql_port = 3306;
@@ -69,4 +73,3 @@ class CommandLine {
6973
};
7074

7175
#endif // #ifndef COMMAND_LINE_H
72-

0 commit comments

Comments
 (0)