|
1 | 1 | *** Settings *** |
2 | 2 | Resource ${CURDIR}${/}stackql.resource |
| 3 | +Library Collections |
3 | 4 |
|
4 | 5 |
|
5 | 6 | *** Keywords *** |
@@ -55,6 +56,19 @@ Start MCP Servers |
55 | 56 | ... stderr=${CURDIR}${/}tmp${/}Stackql-MCP-Server-HTTPS-stderr.txt |
56 | 57 | Sleep 5s |
57 | 58 |
|
| 59 | +Parse MCP JSON Output |
| 60 | + [Arguments] ${stdout} |
| 61 | + ${lines}= Split To Lines ${stdout} |
| 62 | + ${json_lines}= Create List |
| 63 | + FOR ${l} IN @{lines} |
| 64 | + ${trim}= Strip String ${l} |
| 65 | + Run Keyword If "${trim}" != "" and "${trim}"[0]=="{" and "${trim}"[-1]=="}" Append To List ${json_lines} ${trim} |
| 66 | + END |
| 67 | + Should Not Be Empty ${json_lines} |
| 68 | + ${last}= Set Variable ${json_lines}[-1] |
| 69 | + ${parsed}= Evaluate __import__("json").loads(r'''${last}''') |
| 70 | + [Return] ${parsed} |
| 71 | + |
58 | 72 | *** Settings *** |
59 | 73 | Suite Setup Start MCP Servers |
60 | 74 |
|
@@ -240,3 +254,70 @@ Concurrent psql and Reverse Proxy MCP HTTPS Server Query Tool |
240 | 254 | ... stderr=${CURDIR}${/}tmp${/}Concurrent-psql-and-Reverse-Proxy-MCP-HTTPS-Server-Query-Tool-psql-stderr.txt |
241 | 255 | Should Contain ${psql_client_result.stdout} cloudkms.googleapis.com |
242 | 256 | Should Be Equal As Integers ${psql_client_result.rc} 0 |
| 257 | + |
| 258 | +MCP HTTPS Server JSON DTO Verification |
| 259 | + Pass Execution If "%{IS_SKIP_MCP_TEST=false}" == "true" Some platforms do not have the MCP client available |
| 260 | + Sleep 5s |
| 261 | + |
| 262 | + # greet |
| 263 | + ${greet}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action greet \-\-exec.args {"name":"JSON TEST"} |
| 264 | + Should Be Equal As Integers ${greet.rc} 0 |
| 265 | + ${greet_obj}= Parse MCP JSON Output ${greet.stdout} |
| 266 | + Dictionary Should Contain Key ${greet_obj} greeting |
| 267 | + Should Be Equal ${greet_obj["greeting"]} Hi JSON TEST |
| 268 | + |
| 269 | + # server_info |
| 270 | + ${srvinfo}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action server_info |
| 271 | + Should Be Equal As Integers ${srvinfo.rc} 0 |
| 272 | + ${srvinfo_obj}= Parse MCP JSON Output ${srvinfo.stdout} |
| 273 | + Dictionary Should Contain Key ${srvinfo_obj} name |
| 274 | + Dictionary Should Contain Key ${srvinfo_obj} info |
| 275 | + Dictionary Should Contain Key ${srvinfo_obj} is_read_only |
| 276 | + |
| 277 | + # db_identity |
| 278 | + ${dbident}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action db_identity |
| 279 | + Should Be Equal As Integers ${dbident.rc} 0 |
| 280 | + ${dbident_obj}= Parse MCP JSON Output ${dbident.stdout} |
| 281 | + Dictionary Should Contain Key ${dbident_obj} identity |
| 282 | + |
| 283 | + # namespaced server_info |
| 284 | + ${meta_srvinfo}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action meta.server_info |
| 285 | + Should Be Equal As Integers ${meta_srvinfo.rc} 0 |
| 286 | + ${meta_srvinfo_obj}= Parse MCP JSON Output ${meta_srvinfo.stdout} |
| 287 | + Dictionary Should Contain Key ${meta_srvinfo_obj} is_read_only |
| 288 | + |
| 289 | + # query_v2 format=json |
| 290 | + ${query_json}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action query_v2 \-\-exec.args {"sql":"SELECT assetType, count(*) as asset_count FROM google.cloudasset.assets WHERE parentType = 'projects' and parent = 'testing-project' GROUP BY assetType order by count(*) desc, assetType desc;","format":"json"} |
| 291 | + Should Be Equal As Integers ${query_json.rc} 0 |
| 292 | + ${query_obj}= Parse MCP JSON Output ${query_json.stdout} |
| 293 | + Should Be Equal ${query_obj["format"]} json |
| 294 | + Dictionary Should Contain Key ${query_obj} rows |
| 295 | + ${row_count}= Get From Dictionary ${query_obj} row_count |
| 296 | + Should Be True ${row_count} > 0 |
| 297 | + |
| 298 | + # query.exec_text |
| 299 | + ${ns_query_text}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action query.exec_text \-\-exec.args {"sql":"SELECT 1","format":"text"} |
| 300 | + Should Be Equal As Integers ${ns_query_text.rc} 0 |
| 301 | + ${ns_query_text_obj}= Parse MCP JSON Output ${ns_query_text.stdout} |
| 302 | + Should Be Equal ${ns_query_text_obj["format"]} text |
| 303 | + Dictionary Should Contain Key ${ns_query_text_obj} raw |
| 304 | + |
| 305 | + # query.exec_json |
| 306 | + ${ns_query_json}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action query.exec_json \-\-exec.args {"sql":"SELECT 1","row_limit":5} |
| 307 | + Should Be Equal As Integers ${ns_query_json.rc} 0 |
| 308 | + ${ns_query_json_obj}= Parse MCP JSON Output ${ns_query_json.stdout} |
| 309 | + Should Be Equal ${ns_query_json_obj["format"]} json |
| 310 | + ${ns_row_count}= Get From Dictionary ${ns_query_json_obj} row_count |
| 311 | + Should Be True ${ns_row_count} >= 0 |
| 312 | + |
| 313 | + # meta.get_foreign_keys |
| 314 | + ${meta_fk}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action meta.get_foreign_keys \-\-exec.args {"provider":"google","service":"cloudresourcemanager","resource":"projects"} |
| 315 | + Should Be Equal As Integers ${meta_fk.rc} 0 |
| 316 | + ${meta_fk_obj}= Parse MCP JSON Output ${meta_fk.stdout} |
| 317 | + Dictionary Should Contain Key ${meta_fk_obj} text |
| 318 | + |
| 319 | + # meta.find_relationships |
| 320 | + ${meta_rels}= Run Process ${STACKQL_MCP_CLIENT_EXE} exec \-\-client\-type\=http \-\-url\=https://127.0.0.1:9004 \-\-client\-cfg { "apply_tls_globally": true, "insecure_skip_verify": true, "ca_file": "test/server/mtls/credentials/pg_server_cert.pem", "promote_leaf_to_ca": true } \-\-exec.action meta.find_relationships \-\-exec.args {"provider":"google","service":"cloudresourcemanager","resource":"projects"} |
| 321 | + Should Be Equal As Integers ${meta_rels.rc} 0 |
| 322 | + ${meta_rels_obj}= Parse MCP JSON Output ${meta_rels.stdout} |
| 323 | + Dictionary Should Contain Key ${meta_rels_obj} text |
0 commit comments