postgres and cloud logging

This commit is contained in:
duwenxin
2026-02-10 08:36:53 -05:00
parent da5b69739b
commit bab97ee413
2 changed files with 10 additions and 2 deletions

View File

@@ -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")
}
})
}

View File

@@ -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)