Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5a85cce78 |
No files matched your search
@@ -108,7 +108,7 @@ func buildListInstancesRequest(attributes *SetAttributes, catalog *CatalogAttrib
|
||||
return nil, fmt.Errorf("error building filters: %w", err)
|
||||
}
|
||||
|
||||
if len(filters) > 1 {
|
||||
if len(filters) > 0 {
|
||||
filters := strings.Join(filters, " AND ")
|
||||
request.Filter = &filters
|
||||
}
|
||||
|
||||
@@ -183,6 +183,23 @@ func TestBuildListInstancesRequest(t *testing.T) {
|
||||
},
|
||||
expectedErrContains: "error building filters",
|
||||
},
|
||||
{
|
||||
name: "valid request with no filters",
|
||||
attributes: &SetAttributes{
|
||||
Filters: []string{},
|
||||
},
|
||||
catalog: &CatalogAttributes{
|
||||
CredentialAttributes: &cred.CredentialAttributes{
|
||||
ProjectId: "test-12345",
|
||||
Zone: "us-central-1a",
|
||||
},
|
||||
},
|
||||
expected: &computepb.ListInstancesRequest{
|
||||
Project: "test-12345",
|
||||
Zone: "us-central-1a",
|
||||
Filter: stringPtr("status = running"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
||||
Reference in new issue
Block a user