mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-12 08:05:06 -05:00
replace badrequests
This commit is contained in:
@@ -169,11 +169,10 @@ func TestCloneInstanceToolEndpoints(t *testing.T) {
|
||||
want: `{"name":"op2","status":"PENDING"}`,
|
||||
},
|
||||
{
|
||||
name: "missing destination instance name",
|
||||
toolName: "clone-instance",
|
||||
body: `{"project": "p1", "sourceInstanceName": "source-instance"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing destination instance name",
|
||||
toolName: "clone-instance",
|
||||
body: `{"project": "p1", "sourceInstanceName": "source-instance"}`,
|
||||
want: `{"error":"parameter \"destinationInstanceName\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -158,11 +158,10 @@ func TestCreateBackupToolEndpoints(t *testing.T) {
|
||||
want: `{"name":"op1","status":"PENDING"}`,
|
||||
},
|
||||
{
|
||||
name: "missing instance name",
|
||||
toolName: "create-backup",
|
||||
body: `{"project": "p1", "escription": "invalid"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing instance name",
|
||||
toolName: "create-backup",
|
||||
body: `{"project": "p1", "escription": "invalid"}`,
|
||||
want: `{"error":"parameter \"instance\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -155,11 +155,10 @@ func TestCreateDatabaseToolEndpoints(t *testing.T) {
|
||||
want: `{"name":"op1","status":"PENDING"}`,
|
||||
},
|
||||
{
|
||||
name: "missing name",
|
||||
toolName: "create-database",
|
||||
body: `{"project": "p1", "instance": "i1"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing name",
|
||||
toolName: "create-database",
|
||||
body: `{"project": "p1", "instance": "i1"}`,
|
||||
want: `{"error":"parameter \"name\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -138,11 +138,10 @@ func TestListDatabasesToolEndpoints(t *testing.T) {
|
||||
want: `[{"name":"db1","charset":"utf8","collation":"utf8_general_ci"},{"name":"db2","charset":"utf8mb4","collation":"utf8mb4_unicode_ci"}]`,
|
||||
},
|
||||
{
|
||||
name: "missing instance",
|
||||
toolName: "list-databases",
|
||||
body: `{"project": "p1"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing instance",
|
||||
toolName: "list-databases",
|
||||
body: `{"project": "p1"}`,
|
||||
want: `{"error":"parameter \"instance\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -188,18 +188,16 @@ func TestRestoreBackupToolEndpoints(t *testing.T) {
|
||||
want: `{"error":"error processing GCP request: source project and instance are required when restoring via backup ID"}`,
|
||||
},
|
||||
{
|
||||
name: "missing backup identifier",
|
||||
toolName: "restore-backup",
|
||||
body: `{"target_project": "p1", "target_instance": "instance-project-level"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing backup identifier",
|
||||
toolName: "restore-backup",
|
||||
body: `{"target_project": "p1", "target_instance": "instance-project-level"}`,
|
||||
want: `{"error":"source project and instance are required when restoring via backup ID"}`,
|
||||
},
|
||||
{
|
||||
name: "missing target instance info",
|
||||
toolName: "restore-backup",
|
||||
body: `{"backup_id": "12345"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing target instance info",
|
||||
toolName: "restore-backup",
|
||||
body: `{"backup_id": "12345"}`,
|
||||
want: `{"error":"parameter \"target_instance\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user