Skip to content

Commit 0c8a21c

Browse files
authored
fix(core): uint32 and uint64 listers with AllZones and AllRegions (#1569)
1 parent 0f695e4 commit 0c8a21c

File tree

5 files changed

+492
-41
lines changed

5 files changed

+492
-41
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package container
2+
3+
import (
4+
"testing"
5+
6+
"github.com/scaleway/scaleway-sdk-go/internal/testhelpers"
7+
"github.com/scaleway/scaleway-sdk-go/internal/testhelpers/httprecorder"
8+
"github.com/scaleway/scaleway-sdk-go/scw"
9+
)
10+
11+
func TestListContainerNamespaceMultipleRegions(t *testing.T) {
12+
client, r, err := httprecorder.CreateRecordedScwClient("container-list-regions")
13+
testhelpers.AssertNoError(t, err)
14+
defer func() {
15+
testhelpers.AssertNoError(t, r.Stop()) // Make sure recorder is stopped once done with it
16+
}()
17+
18+
containerAPI := NewAPI(client)
19+
20+
// Create server
21+
_, err = containerAPI.ListNamespaces(&ListNamespacesRequest{}, scw.WithRegions(containerAPI.Regions()...))
22+
testhelpers.Assert(t, err == nil, "This request should not error: %s", err)
23+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.20.1; linux; amd64)
10+
url: https://api.scaleway.com/containers/v1beta1/regions/fr-par/namespaces?order_by=created_at_asc
11+
method: GET
12+
response:
13+
body: '{"namespaces":[], "total_count":0}'
14+
headers:
15+
Content-Length:
16+
- "34"
17+
Content-Security-Policy:
18+
- default-src 'none'; frame-ancestors 'none'
19+
Content-Type:
20+
- application/json
21+
Date:
22+
- Fri, 03 Mar 2023 11:09:20 GMT
23+
Server:
24+
- Scaleway API-Gateway
25+
Strict-Transport-Security:
26+
- max-age=63072000
27+
X-Content-Type-Options:
28+
- nosniff
29+
X-Frame-Options:
30+
- DENY
31+
X-Request-Id:
32+
- 64534ead-60ca-4176-a37c-89f2781ec10e
33+
status: 200 OK
34+
code: 200
35+
duration: ""
36+
- request:
37+
body: ""
38+
form: {}
39+
headers:
40+
User-Agent:
41+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.20.1; linux; amd64)
42+
url: https://api.scaleway.com/containers/v1beta1/regions/nl-ams/namespaces?order_by=created_at_asc
43+
method: GET
44+
response:
45+
body: '{"namespaces":[{"id":"5113d87a-3a49-4e8d-be27-e1a20b9a59c1", "name":"dfdsffsfsqf",
46+
"environment_variables":{}, "organization_id":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
47+
"project_id":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b", "status":"ready", "registry_namespace_id":"d0afb8a1-6417-4e7e-8a1c-29e348f96f05",
48+
"error_message":null, "registry_endpoint":"rg.nl-ams.scw.cloud/funcscwdfdsffsfsqfkvsfbdbr",
49+
"description":"", "secret_environment_variables":[], "region":"nl-ams"}], "total_count":1}'
50+
headers:
51+
Content-Length:
52+
- "486"
53+
Content-Security-Policy:
54+
- default-src 'none'; frame-ancestors 'none'
55+
Content-Type:
56+
- application/json
57+
Date:
58+
- Fri, 03 Mar 2023 11:09:20 GMT
59+
Server:
60+
- Scaleway API-Gateway
61+
Strict-Transport-Security:
62+
- max-age=63072000
63+
X-Content-Type-Options:
64+
- nosniff
65+
X-Frame-Options:
66+
- DENY
67+
X-Request-Id:
68+
- ef764335-0239-4aa5-92ca-a91a9a22db3a
69+
status: 200 OK
70+
code: 200
71+
duration: ""
72+
- request:
73+
body: ""
74+
form: {}
75+
headers:
76+
User-Agent:
77+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.20.1; linux; amd64)
78+
url: https://api.scaleway.com/containers/v1beta1/regions/pl-waw/namespaces?order_by=created_at_asc
79+
method: GET
80+
response:
81+
body: '{"namespaces":[], "total_count":0}'
82+
headers:
83+
Content-Length:
84+
- "34"
85+
Content-Security-Policy:
86+
- default-src 'none'; frame-ancestors 'none'
87+
Content-Type:
88+
- application/json
89+
Date:
90+
- Fri, 03 Mar 2023 11:09:20 GMT
91+
Server:
92+
- Scaleway API-Gateway
93+
Strict-Transport-Security:
94+
- max-age=63072000
95+
X-Content-Type-Options:
96+
- nosniff
97+
X-Frame-Options:
98+
- DENY
99+
X-Request-Id:
100+
- 33115f4e-1a87-41cb-8ba4-0ec491271287
101+
status: 200 OK
102+
code: 200
103+
duration: ""

api/instance/v1/instance_sdk_server_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,17 @@ func TestCreateServerWithIncorrectBody(t *testing.T) {
163163
})
164164
testhelpers.Assert(t, err != nil, "This request should error")
165165
}
166+
167+
func TestListServerMultipleZones(t *testing.T) {
168+
client, r, err := httprecorder.CreateRecordedScwClient("server-list-zones")
169+
testhelpers.AssertNoError(t, err)
170+
defer func() {
171+
testhelpers.AssertNoError(t, r.Stop()) // Make sure recorder is stopped once done with it
172+
}()
173+
174+
instanceAPI := NewAPI(client)
175+
176+
// Create server
177+
_, err = instanceAPI.ListServers(&ListServersRequest{}, scw.WithZones(instanceAPI.Zones()...))
178+
testhelpers.Assert(t, err == nil, "This request should not error: %s", err)
179+
}

0 commit comments

Comments
 (0)