Skip to content

Commit 8c62a49

Browse files
scaleway-botremyleoneCodelax
authored
fix(marketplace): order by type by default (#2120)
Co-authored-by: Rémy Léone <[email protected]> Co-authored-by: Jules Casteran <[email protected]>
1 parent 5369dd2 commit 8c62a49

File tree

7 files changed

+204
-253
lines changed

7 files changed

+204
-253
lines changed

api/instance/v1/server_utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func TestAPI_CreateServer(t *testing.T) {
162162

163163
testhelpers.AssertNoError(t, err)
164164
// this UUID might change when running the cassette later when the image "ubuntu_focal" got a new version
165-
testhelpers.Equals(t, "1bed752e-f775-4ec2-b179-40af20ec1eec", res.Server.Image.ID)
165+
testhelpers.Equals(t, "9c41e95b-add2-4ef8-b1b1-af8899748eda", res.Server.Image.ID)
166166
err = instanceAPI.DeleteServer(&DeleteServerRequest{
167167
Zone: scw.ZoneFrPar1,
168168
ServerID: res.Server.ID,

api/instance/v1/testdata/create-server.yaml

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,34 @@ interactions:
77
headers:
88
User-Agent:
99
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.21.1; linux; amd64)
10-
url: https://api.scaleway.com/marketplace/v2/local-images?image_label=ubuntu_focal&order_by=created_at_asc&type=unknown_type&zone=fr-par-1
10+
url: https://api.scaleway.com/marketplace/v2/local-images?image_label=ubuntu_focal&order_by=type_asc&type=unknown_type&zone=fr-par-1
1111
method: GET
1212
response:
13-
body: '{"local_images":[{"id":"1bed752e-f775-4ec2-b179-40af20ec1eec", "arch":"x86_64",
14-
"zone":"fr-par-1", "compatible_commercial_types":["DEV1-L", "DEV1-M", "DEV1-S",
15-
"DEV1-XL", "GP1-L", "GP1-M", "GP1-S", "GP1-XL", "GP1-XS", "START1-L", "START1-M",
16-
"START1-S", "START1-XS", "VC1L", "VC1M", "VC1S", "X64-120GB", "X64-15GB", "X64-30GB",
17-
"X64-60GB", "ENT1-XXS", "ENT1-XS", "ENT1-S", "ENT1-M", "ENT1-L", "ENT1-XL",
18-
"ENT1-2XL", "PRO2-XXS", "PRO2-XS", "PRO2-S", "PRO2-M", "PRO2-L", "STARDUST1-S",
19-
"PLAY2-MICRO", "PLAY2-NANO", "PLAY2-PICO", "POP2-2C-8G", "POP2-4C-16G", "POP2-8C-32G",
20-
"POP2-16C-64G", "POP2-32C-128G", "POP2-64C-256G", "POP2-HM-2C-16G", "POP2-HM-4C-32G",
21-
"POP2-HM-8C-64G", "POP2-HM-16C-128G", "POP2-HM-32C-256G", "POP2-HM-64C-512G",
22-
"POP2-HC-2C-4G", "POP2-HC-4C-8G", "POP2-HC-8C-16G", "POP2-HC-16C-32G", "POP2-HC-32C-64G",
23-
"POP2-HC-64C-128G"], "label":"ubuntu_focal", "type":"instance_local"}, {"id":"9517ef8a-b830-4880-ab30-3f2366a8a207",
24-
"arch":"arm64", "zone":"fr-par-1", "compatible_commercial_types":["AMP2-C1",
25-
"AMP2-C2", "AMP2-C4", "AMP2-C8", "AMP2-C12", "AMP2-C24", "AMP2-C48", "AMP2-C60",
26-
"COPARM1-2C-8G", "COPARM1-4C-16G", "COPARM1-8C-32G", "COPARM1-16C-64G", "COPARM1-32C-128G"],
27-
"label":"ubuntu_focal", "type":"instance_local"}], "total_count":2}'
13+
body: '{"local_images":[{"id":"19f37e3e-d8c4-43cb-a739-7ccefec2a489","arch":"arm64","zone":"fr-par-1","compatible_commercial_types":["AMP2-C1","AMP2-C2","AMP2-C4","AMP2-C8","AMP2-C12","AMP2-C24","AMP2-C48","AMP2-C60","COPARM1-2C-8G","COPARM1-4C-16G","COPARM1-8C-32G","COPARM1-16C-64G","COPARM1-32C-128G"],"label":"ubuntu_focal","type":"instance_local"},{"id":"9c41e95b-add2-4ef8-b1b1-af8899748eda","arch":"x86_64","zone":"fr-par-1","compatible_commercial_types":["DEV1-L","DEV1-M","DEV1-S","DEV1-XL","GP1-L","GP1-M","GP1-S","GP1-XL","GP1-XS","START1-L","START1-M","START1-S","START1-XS","VC1L","VC1M","VC1S","X64-120GB","X64-15GB","X64-30GB","X64-60GB","ENT1-XXS","ENT1-XS","ENT1-S","ENT1-M","ENT1-L","ENT1-XL","ENT1-2XL","PRO2-XXS","PRO2-XS","PRO2-S","PRO2-M","PRO2-L","STARDUST1-S","PLAY2-MICRO","PLAY2-NANO","PLAY2-PICO","POP2-2C-8G","POP2-4C-16G","POP2-8C-32G","POP2-16C-64G","POP2-32C-128G","POP2-64C-256G","POP2-HM-2C-16G","POP2-HM-4C-32G","POP2-HM-8C-64G","POP2-HM-16C-128G","POP2-HM-32C-256G","POP2-HM-64C-512G","POP2-HC-2C-4G","POP2-HC-4C-8G","POP2-HC-8C-16G","POP2-HC-16C-32G","POP2-HC-32C-64G","POP2-HC-64C-128G"],"label":"ubuntu_focal","type":"instance_local"},{"id":"1de03aca-1106-4152-bd36-f057c0cce9f1","arch":"arm64","zone":"fr-par-1","compatible_commercial_types":["AMP2-C1","AMP2-C2","AMP2-C4","AMP2-C8","AMP2-C12","AMP2-C24","AMP2-C48","AMP2-C60","COPARM1-2C-8G","COPARM1-4C-16G","COPARM1-8C-32G","COPARM1-16C-64G","COPARM1-32C-128G"],"label":"ubuntu_focal","type":"instance_sbs"},{"id":"60dd2959-89ce-4636-b54d-f1bb2ce9bde8","arch":"x86_64","zone":"fr-par-1","compatible_commercial_types":["DEV1-L","DEV1-M","DEV1-S","DEV1-XL","GP1-L","GP1-M","GP1-S","GP1-XL","GP1-XS","START1-L","START1-M","START1-S","START1-XS","VC1L","VC1M","VC1S","X64-120GB","X64-15GB","X64-30GB","X64-60GB","ENT1-XXS","ENT1-XS","ENT1-S","ENT1-M","ENT1-L","ENT1-XL","ENT1-2XL","PRO2-XXS","PRO2-XS","PRO2-S","PRO2-M","PRO2-L","STARDUST1-S","PLAY2-MICRO","PLAY2-NANO","PLAY2-PICO","POP2-2C-8G","POP2-4C-16G","POP2-8C-32G","POP2-16C-64G","POP2-32C-128G","POP2-64C-256G","POP2-HM-2C-16G","POP2-HM-4C-32G","POP2-HM-8C-64G","POP2-HM-16C-128G","POP2-HM-32C-256G","POP2-HM-64C-512G","POP2-HC-2C-4G","POP2-HC-4C-8G","POP2-HC-8C-16G","POP2-HC-16C-32G","POP2-HC-32C-64G","POP2-HC-64C-128G"],"label":"ubuntu_focal","type":"instance_sbs"}],"total_count":4}'
2814
headers:
2915
Content-Length:
30-
- "1260"
16+
- "2328"
3117
Content-Security-Policy:
3218
- default-src 'none'; frame-ancestors 'none'
3319
Content-Type:
3420
- application/json
3521
Date:
36-
- Wed, 13 Mar 2024 14:04:08 GMT
22+
- Fri, 05 Jul 2024 09:32:10 GMT
3723
Server:
38-
- Scaleway API Gateway (fr-par-2;edge01)
24+
- Scaleway API Gateway (fr-par-3;edge02)
3925
Strict-Transport-Security:
4026
- max-age=63072000
4127
X-Content-Type-Options:
4228
- nosniff
4329
X-Frame-Options:
4430
- DENY
4531
X-Request-Id:
46-
- 175c82ab-efe5-4bc2-9ee0-f7c27ad4dbff
32+
- 6d100b8a-5b13-4c9e-bc11-9733c577e898
4733
status: 200 OK
4834
code: 200
4935
duration: ""
5036
- request:
51-
body: '{"name":"srv-optimistic-mirzakhani","commercial_type":"GP1-XS","image":"1bed752e-f775-4ec2-b179-40af20ec1eec","project":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b"}'
37+
body: '{"name":"srv-ecstatic-saha","commercial_type":"GP1-XS","image":"9c41e95b-add2-4ef8-b1b1-af8899748eda","project":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b"}'
5238
form: {}
5339
headers:
5440
Content-Type:
@@ -58,57 +44,57 @@ interactions:
5844
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers
5945
method: POST
6046
response:
61-
body: '{"server": {"id": "6c125ef5-2567-46f9-aa8a-acbb05894cbf", "name": "srv-optimistic-mirzakhani",
47+
body: '{"server": {"id": "973c6deb-c4c4-47e9-b9b9-62fdd812fb42", "name": "srv-ecstatic-saha",
6248
"arch": "x86_64", "commercial_type": "GP1-XS", "boot_type": "local", "organization":
6349
"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b", "project": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
64-
"hostname": "srv-optimistic-mirzakhani", "image": {"id": "1bed752e-f775-4ec2-b179-40af20ec1eec",
50+
"hostname": "srv-ecstatic-saha", "image": {"id": "9c41e95b-add2-4ef8-b1b1-af8899748eda",
6551
"name": "Ubuntu 20.04 Focal Fossa", "organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
66-
"project": "51b656e3-4865-41e8-adbc-0c45bdd780db", "root_volume": {"id": "9199297e-fd35-4012-9164-8c97820f205b",
52+
"project": "51b656e3-4865-41e8-adbc-0c45bdd780db", "root_volume": {"id": "f7bff04a-ee32-4bf5-ae53-2280e11d8977",
6753
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "unified", "size": 10000000000},
68-
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2024-02-22T15:47:31.528876+00:00",
69-
"modification_date": "2024-02-22T15:47:31.528876+00:00", "default_bootscript":
70-
null, "from_server": null, "state": "available", "tags": [], "zone": "fr-par-1"},
71-
"volumes": {"0": {"boot": false, "id": "f866b8e9-22fc-43c4-a1e0-f5ad6380bc8b",
54+
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2024-07-03T19:59:39.939165+00:00",
55+
"modification_date": "2024-07-03T19:59:39.939165+00:00", "default_bootscript":
56+
null, "from_server": "", "state": "available", "tags": [], "zone": "fr-par-1"},
57+
"volumes": {"0": {"boot": false, "id": "36886cc7-3ef4-4cbf-9f33-7dad4a30d987",
7258
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "export_uri": null,
7359
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b", "project": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
74-
"server": {"id": "6c125ef5-2567-46f9-aa8a-acbb05894cbf", "name": "srv-optimistic-mirzakhani"},
75-
"size": 150000000000, "state": "available", "creation_date": "2024-03-13T14:04:09.208979+00:00",
76-
"modification_date": "2024-03-13T14:04:09.208979+00:00", "tags": [], "zone":
60+
"server": {"id": "973c6deb-c4c4-47e9-b9b9-62fdd812fb42", "name": "srv-ecstatic-saha"},
61+
"size": 150000000000, "state": "available", "creation_date": "2024-07-05T09:32:10.284203+00:00",
62+
"modification_date": "2024-07-05T09:32:10.284203+00:00", "tags": [], "zone":
7763
"fr-par-1"}}, "tags": [], "state": "stopped", "protected": false, "state_detail":
78-
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:44:07:b9",
79-
"routed_ip_enabled": false, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
80-
true, "enable_ipv6": false, "private_ip": null, "creation_date": "2024-03-13T14:04:09.208979+00:00",
81-
"modification_date": "2024-03-13T14:04:09.208979+00:00", "bootscript": {"id":
64+
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:5f:9a:41",
65+
"routed_ip_enabled": true, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
66+
true, "enable_ipv6": false, "private_ip": null, "creation_date": "2024-07-05T09:32:10.284203+00:00",
67+
"modification_date": "2024-07-05T09:32:10.284203+00:00", "bootscript": {"id":
8268
"fdfe150f-a870-4ce4-b432-9f56b5b995c1", "public": true, "title": "x86_64 mainline
8369
4.4.230 rev1", "architecture": "x86_64", "organization": "11111111-1111-4111-8111-111111111111",
8470
"project": "11111111-1111-4111-8111-111111111111", "kernel": "http://10.194.3.9/kernel/x86_64-mainline-lts-4.4-4.4.230-rev1/vmlinuz-4.4.230",
8571
"dtb": "", "initrd": "http://10.194.3.9/initrd/initrd-Linux-x86_64-v3.14.6.gz",
8672
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16", "default":
8773
true, "zone": "fr-par-1"}, "security_group": {"id": "0fe819c3-274d-472a-b3f5-ddb258d2d8bb",
8874
"name": "Default security group"}, "location": null, "maintenances": [], "allowed_actions":
89-
["poweron", "backup", "enable_routed_ip"], "placement_group": null, "private_nics":
90-
[], "zone": "fr-par-1"}}'
75+
["poweron", "backup"], "placement_group": null, "private_nics": [], "zone":
76+
"fr-par-1"}}'
9177
headers:
9278
Content-Length:
93-
- "2657"
79+
- "2610"
9480
Content-Security-Policy:
9581
- default-src 'none'; frame-ancestors 'none'
9682
Content-Type:
9783
- application/json
9884
Date:
99-
- Wed, 13 Mar 2024 14:04:09 GMT
85+
- Fri, 05 Jul 2024 09:32:10 GMT
10086
Location:
101-
- https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/6c125ef5-2567-46f9-aa8a-acbb05894cbf
87+
- https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/973c6deb-c4c4-47e9-b9b9-62fdd812fb42
10288
Server:
103-
- Scaleway API Gateway (fr-par-2;edge01)
89+
- Scaleway API Gateway (fr-par-3;edge02)
10490
Strict-Transport-Security:
10591
- max-age=63072000
10692
X-Content-Type-Options:
10793
- nosniff
10894
X-Frame-Options:
10995
- DENY
11096
X-Request-Id:
111-
- d7e71ed3-9be6-4ee6-9e19-5e9ee1d850bb
97+
- 268eec6d-1c3c-4c02-80e4-1466777e1533
11298
status: 201 Created
11399
code: 201
114100
duration: ""
@@ -118,25 +104,27 @@ interactions:
118104
headers:
119105
User-Agent:
120106
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.21.1; linux; amd64)
121-
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/6c125ef5-2567-46f9-aa8a-acbb05894cbf
107+
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/973c6deb-c4c4-47e9-b9b9-62fdd812fb42
122108
method: DELETE
123109
response:
124110
body: ""
125111
headers:
126112
Content-Security-Policy:
127113
- default-src 'none'; frame-ancestors 'none'
114+
Content-Type:
115+
- application/json
128116
Date:
129-
- Wed, 13 Mar 2024 14:04:09 GMT
117+
- Fri, 05 Jul 2024 09:32:10 GMT
130118
Server:
131-
- Scaleway API Gateway (fr-par-2;edge01)
119+
- Scaleway API Gateway (fr-par-3;edge02)
132120
Strict-Transport-Security:
133121
- max-age=63072000
134122
X-Content-Type-Options:
135123
- nosniff
136124
X-Frame-Options:
137125
- DENY
138126
X-Request-Id:
139-
- e73e8a6b-4c6f-4c25-becd-fe029e2a3001
127+
- b492939b-85ad-43ba-b34a-7ea96c4e91b5
140128
status: 204 No Content
141129
code: 204
142130
duration: ""

0 commit comments

Comments
 (0)