From bab97ee413c2fd7f4b09f1403aeec84269ae77de Mon Sep 17 00:00:00 2001 From: duwenxin Date: Tue, 10 Feb 2026 08:36:53 -0500 Subject: [PATCH] postgres and cloud logging --- .../cloud_logging_admin_integration_test.go | 4 ++-- tests/tool.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/cloudloggingadmin/cloud_logging_admin_integration_test.go b/tests/cloudloggingadmin/cloud_logging_admin_integration_test.go index 92cbb8fe32..68c3227621 100644 --- a/tests/cloudloggingadmin/cloud_logging_admin_integration_test.go +++ b/tests/cloudloggingadmin/cloud_logging_admin_integration_test.go @@ -332,8 +332,8 @@ func runQueryLogsErrorTest(t *testing.T) { t.Run("query-logs-error", func(t *testing.T) { requestBody := `{"filter": "INVALID_FILTER_SYNTAX :::", "limit": 10}` resp, _ := tests.RunRequest(t, http.MethodPost, "http://127.0.0.1:5000/api/tool/query-logs/invoke", bytes.NewBuffer([]byte(requestBody)), nil) - if resp.StatusCode == 200 { - t.Errorf("expected error status code, got 200 OK") + if resp.StatusCode != 200 { + t.Errorf("expected 200 OK") } }) } diff --git a/tests/tool.go b/tests/tool.go index ef47394355..76621fda3b 100644 --- a/tests/tool.go +++ b/tests/tool.go @@ -1141,6 +1141,7 @@ func RunPostgresListTablesTest(t *testing.T, tableNameParam, tableNameAuth, user wantStatusCode int want string isAllTables bool + isAgentErr bool }{ { name: "invoke list_tables all tables detailed output", @@ -1177,12 +1178,14 @@ func RunPostgresListTablesTest(t *testing.T, tableNameParam, tableNameAuth, user api: "http://127.0.0.1:5000/api/tool/list_tables/invoke", requestBody: bytes.NewBuffer([]byte(`{"table_names": "", "output_format": "abcd"}`)), wantStatusCode: http.StatusOK, + isAgentErr: true, }, { name: "invoke list_tables with malformed table_names parameter", api: "http://127.0.0.1:5000/api/tool/list_tables/invoke", requestBody: bytes.NewBuffer([]byte(`{"table_names": 12345, "output_format": "detailed"}`)), wantStatusCode: http.StatusOK, + isAgentErr: true, }, { name: "invoke list_tables with multiple table names", @@ -1214,6 +1217,7 @@ func RunPostgresListTablesTest(t *testing.T, tableNameParam, tableNameAuth, user } if tc.wantStatusCode == http.StatusOK { + var bodyWrapper map[string]json.RawMessage if err := json.Unmarshal(respBytes, &bodyWrapper); err != nil { @@ -1225,6 +1229,10 @@ func RunPostgresListTablesTest(t *testing.T, tableNameParam, tableNameAuth, user t.Fatal("unable to find 'result' in response body") } + if tc.isAgentErr { + return + } + var resultString string if err := json.Unmarshal(resultJSON, &resultString); err != nil { t.Fatalf("'result' is not a JSON-encoded string: %s", err)