Skip to content

Commit 85c83a2

Browse files
authored
fix(baremetal): update offer type (scaleway#4354)
1 parent fc9456f commit 85c83a2

28 files changed

+8254
-5818
lines changed

internal/namespaces/applesilicon/v1alpha1/testdata/test-os-display-simple.cassette.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@
22
version: 1
33
interactions:
44
- request:
5-
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374", "name":"macos-sonoma-14",
6-
"label":"macOS Sonoma 14", "image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png",
7-
"family":"Sonoma", "is_beta":false, "xcode_version":"15", "version":"14.4",
8-
"compatible_server_types":["M1-M", "M2-M", "M2-L"]}'
5+
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
6+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]}'
97
form: {}
108
headers:
119
User-Agent:
12-
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.22.2; darwin; amd64) cli-e2e-test
10+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.23.2; darwin; arm64) cli-e2e-test
1311
url: https://api.scaleway.com/apple-silicon/v1alpha1/zones/fr-par-1/os/e08d1e5d-b4b9-402a-9f9a-97732d17e374
1412
method: GET
1513
response:
16-
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374", "name":"macos-sonoma-14",
17-
"label":"macOS Sonoma 14", "image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png",
18-
"family":"Sonoma", "is_beta":false, "xcode_version":"15", "version":"14.4",
19-
"compatible_server_types":["M1-M", "M2-M", "M2-L"]}'
14+
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
15+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]}'
2016
headers:
2117
Content-Length:
22-
- "319"
18+
- "313"
2319
Content-Security-Policy:
2420
- default-src 'none'; frame-ancestors 'none'
2521
Content-Type:
2622
- application/json
2723
Date:
28-
- Tue, 11 Jun 2024 08:37:10 GMT
24+
- Wed, 11 Dec 2024 10:57:15 GMT
2925
Server:
3026
- Scaleway API Gateway (fr-par-1;edge02)
3127
Strict-Transport-Security:
@@ -35,7 +31,7 @@ interactions:
3531
X-Frame-Options:
3632
- DENY
3733
X-Request-Id:
38-
- 08a51853-e9da-4643-aaf8-13d240591fb3
34+
- 99d01325-b45c-45e6-9e05-875caec82c88
3935
status: 200 OK
4036
code: 200
4137
duration: ""

internal/namespaces/applesilicon/v1alpha1/testdata/test-os-display-simple.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
33
ID e08d1e5d-b4b9-402a-9f9a-97732d17e374
4-
Name macos-sonoma-14
5-
Label macOS Sonoma 14
4+
Name macos-sonoma-14.4
5+
Label macOS Sonoma 14.4
66
ImageURL https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png
77
Family Sonoma
88
IsBeta false
@@ -14,8 +14,8 @@ CompatibleServerTypes:
1414
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1515
{
1616
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
17-
"name": "macos-sonoma-14",
18-
"label": "macOS Sonoma 14",
17+
"name": "macos-sonoma-14.4",
18+
"label": "macOS Sonoma 14.4",
1919
"image_url": "https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png",
2020
"family": "Sonoma",
2121
"is_beta": false,

internal/namespaces/applesilicon/v1alpha1/testdata/test-server-type-list-base.cassette.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,40 @@
22
version: 1
33
interactions:
44
- request:
5-
body: ""
5+
body: '{"server_types":[{"name":"M2-M","cpu":{"name":"Apple M2","core_count":8,"frequency":3500000000},"disk":{"capacity":256000000000,"type":"SSD"},"memory":{"capacity":16000000000,"type":"LPDDR5"},"stock":"high_stock","minimum_lease_duration":"86400s","default_os":{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
6+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]},"gpu":{"count":10},"network":{"public_bandwidth_bps":1000000000}},{"name":"M2-L","cpu":{"name":"Apple
7+
M2 Pro","core_count":10,"frequency":3500000000},"disk":{"capacity":512000000000,"type":"SSD"},"memory":{"capacity":16000000000,"type":"LPDDR5"},"stock":"high_stock","minimum_lease_duration":"86400s","default_os":{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
8+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]},"gpu":{"count":16},"network":{"public_bandwidth_bps":1000000000}}]}'
69
form: {}
710
headers:
811
User-Agent:
9-
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.15.7; darwin; amd64) cli-e2e-test
12+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.23.2; darwin; arm64) cli-e2e-test
1013
url: https://api.scaleway.com/apple-silicon/v1alpha1/zones/fr-par-1/server-types
1114
method: GET
1215
response:
13-
body: '{"server_types":[{"name":"M1-M","cpu":{"name":"Apple M1","core_count":8},"disk":{"capacity":256000000000,"type":"SSD"},"memory":{"capacity":8000000000,"type":"LPDDR4"},"stock":"low_stock","minimum_lease_duration":"86400s"}]}'
16+
body: '{"server_types":[{"name":"M2-M","cpu":{"name":"Apple M2","core_count":8,"frequency":3500000000},"disk":{"capacity":256000000000,"type":"SSD"},"memory":{"capacity":16000000000,"type":"LPDDR5"},"stock":"high_stock","minimum_lease_duration":"86400s","default_os":{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
17+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]},"gpu":{"count":10},"network":{"public_bandwidth_bps":1000000000}},{"name":"M2-L","cpu":{"name":"Apple
18+
M2 Pro","core_count":10,"frequency":3500000000},"disk":{"capacity":512000000000,"type":"SSD"},"memory":{"capacity":16000000000,"type":"LPDDR5"},"stock":"high_stock","minimum_lease_duration":"86400s","default_os":{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
19+
Sonoma 14.4","image_url":"https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png","family":"Sonoma","is_beta":false,"xcode_version":"15","version":"14.4","compatible_server_types":["M1-M","M2-M","M2-L"]},"gpu":{"count":16},"network":{"public_bandwidth_bps":1000000000}}]}'
1420
headers:
1521
Content-Length:
16-
- "224"
22+
- "1269"
1723
Content-Security-Policy:
1824
- default-src 'none'; frame-ancestors 'none'
1925
Content-Type:
2026
- application/json
2127
Date:
22-
- Fri, 05 Feb 2021 18:04:16 GMT
28+
- Wed, 11 Dec 2024 10:57:16 GMT
2329
Server:
24-
- Scaleway API-Gateway
30+
- Scaleway API Gateway (fr-par-1;edge02)
2531
Strict-Transport-Security:
2632
- max-age=63072000
2733
X-Content-Type-Options:
2834
- nosniff
2935
X-Frame-Options:
3036
- DENY
3137
X-Request-Id:
32-
- f68db5c3-b1c7-4cb4-98dd-67d6cd32c41a
38+
- 25a5fd08-35cb-41b5-bf40-d101f078726d
3339
status: 200 OK
3440
code: 200
3541
duration: ""
Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,86 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
3-
Name CPU Memory Disk Stock Minimum Lease Duration
4-
M1-M Apple M1 (8 cores) 8.0 GB 256 GB low stock 1 days
3+
Name CPU Memory Disk Stock Minimum Lease Duration
4+
M2-M Apple M2 (8 cores) 16 GB 256 GB high stock 1 days
5+
M2-L Apple M2 Pro (10 cores) 16 GB 512 GB high stock 1 days
56
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
67
[
78
{
89
"cpu": {
9-
"name": "Apple M1",
10+
"name": "Apple M2",
1011
"core_count": 8,
11-
"frequency": 0
12+
"frequency": 3500000000
1213
},
1314
"disk": {
1415
"capacity": 256000000000,
1516
"type": "SSD"
1617
},
17-
"name": "M1-M",
18+
"name": "M2-M",
1819
"memory": {
19-
"capacity": 8000000000,
20-
"type": "LPDDR4"
20+
"capacity": 16000000000,
21+
"type": "LPDDR5"
2122
},
22-
"stock": "low_stock",
23+
"stock": "high_stock",
2324
"minimum_lease_duration": "86400.000000000s",
24-
"gpu": null,
25-
"network": null,
26-
"default_os": null
25+
"gpu": {
26+
"count": 10
27+
},
28+
"network": {
29+
"public_bandwidth_bps": 1000000000
30+
},
31+
"default_os": {
32+
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
33+
"name": "macos-sonoma-14.4",
34+
"label": "macOS Sonoma 14.4",
35+
"image_url": "https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png",
36+
"family": "Sonoma",
37+
"is_beta": false,
38+
"version": "14.4",
39+
"xcode_version": "15",
40+
"compatible_server_types": [
41+
"M1-M",
42+
"M2-M",
43+
"M2-L"
44+
]
45+
}
46+
},
47+
{
48+
"cpu": {
49+
"name": "Apple M2 Pro",
50+
"core_count": 10,
51+
"frequency": 3500000000
52+
},
53+
"disk": {
54+
"capacity": 512000000000,
55+
"type": "SSD"
56+
},
57+
"name": "M2-L",
58+
"memory": {
59+
"capacity": 16000000000,
60+
"type": "LPDDR5"
61+
},
62+
"stock": "high_stock",
63+
"minimum_lease_duration": "86400.000000000s",
64+
"gpu": {
65+
"count": 16
66+
},
67+
"network": {
68+
"public_bandwidth_bps": 1000000000
69+
},
70+
"default_os": {
71+
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
72+
"name": "macos-sonoma-14.4",
73+
"label": "macOS Sonoma 14.4",
74+
"image_url": "https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png",
75+
"family": "Sonoma",
76+
"is_beta": false,
77+
"version": "14.4",
78+
"xcode_version": "15",
79+
"compatible_server_types": [
80+
"M1-M",
81+
"M2-M",
82+
"M2-L"
83+
]
84+
}
2785
}
2886
]

internal/namespaces/baremetal/v1/custom_server_create_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ func Test_CreateServer(t *testing.T) {
1515
t.Run("Simple", func(t *testing.T) {
1616
t.Run("Default", core.Test(&core.TestConfig{
1717
Commands: baremetal.GetCommands(),
18-
Cmd: "scw baremetal server create zone=fr-par-1 type=EM-B220E-NVME -w",
18+
Cmd: "scw baremetal server create zone=" + region + " type=" + offerName + " -w",
1919
Check: core.TestCheckCombine(
2020
core.TestCheckGolden(),
2121
core.TestCheckExitCode(0),
2222
),
23-
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=fr-par-1"),
23+
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=" + region),
2424
},
2525
))
2626

2727
t.Run("With name", core.Test(&core.TestConfig{
2828
Commands: baremetal.GetCommands(),
29-
Cmd: "scw baremetal server create name=test-create-server-with-name zone=fr-par-1 type=EM-B220E-NVME -w",
29+
Cmd: "scw baremetal server create name=test-create-server-with-name zone=" + region + " type=" + offerName + " -w",
3030
Check: core.TestCheckCombine(
3131
func(t *testing.T, ctx *core.CheckFuncCtx) {
3232
t.Helper()
3333
assert.Equal(t, "test-create-server-with-name", ctx.Result.(*baremetalSDK.Server).Name)
3434
},
3535
core.TestCheckExitCode(0),
3636
),
37-
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=fr-par-1"),
37+
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=" + region),
3838
}))
3939

4040
t.Run("Tags", core.Test(&core.TestConfig{
4141
Commands: baremetal.GetCommands(),
42-
Cmd: "scw baremetal server create tags.0=prod tags.1=blue zone=fr-par-1 type=EM-B220E-NVME -w",
42+
Cmd: "scw baremetal server create tags.0=prod tags.1=blue zone=" + region + " type=" + offerName + " -w",
4343
Check: core.TestCheckCombine(
4444
func(t *testing.T, ctx *core.CheckFuncCtx) {
4545
t.Helper()
@@ -48,7 +48,7 @@ func Test_CreateServer(t *testing.T) {
4848
},
4949
core.TestCheckExitCode(0),
5050
),
51-
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=fr-par-1"),
51+
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=" + region),
5252
}))
5353
})
5454
}

internal/namespaces/baremetal/v1/custom_server_install_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func Test_InstallServer(t *testing.T) {
2323
createServerAndWait("Server"),
2424
),
2525
Commands: cmds,
26-
Cmd: "scw baremetal server install {{ .Server.ID }} zone=nl-ams-1 hostname=test-install-server ssh-key-ids.0={{ .key.ID }} os-id=" + osID + " -w",
26+
Cmd: "scw baremetal server install {{ .Server.ID }} zone=" + region + " hostname=test-install-server ssh-key-ids.0={{ .key.ID }} os-id=" + osID + " -w",
2727
Check: core.TestCheckCombine(
2828
core.TestCheckGolden(),
2929
core.TestCheckExitCode(0),
@@ -40,7 +40,7 @@ func Test_InstallServer(t *testing.T) {
4040
addSSH("key", sshKey),
4141
createServerAndWait("Server"),
4242
),
43-
Cmd: "scw baremetal server install {{ .Server.ID }} zone=nl-ams-1 hostname=test-install-server all-ssh-keys=true os-id=" + osID + " -w",
43+
Cmd: "scw baremetal server install {{ .Server.ID }} zone=" + region + " hostname=test-install-server all-ssh-keys=true os-id=" + osID + " -w",
4444
Check: core.TestCheckCombine(
4545
core.TestCheckGolden(),
4646
core.TestCheckExitCode(0),

internal/namespaces/baremetal/v1/custom_server_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import (
99
"github.com/scaleway/scaleway-sdk-go/scw"
1010
)
1111

12+
const (
13+
offerName = "EM-B220E-NVME"
14+
region = "fr-par-1"
15+
)
16+
1217
func Test_StartServerErrors(t *testing.T) {
1318
t.Run("Error: cannot be started while not delivered", core.Test(&core.TestConfig{
14-
BeforeFunc: createServer("Server"),
19+
BeforeFunc: createServer("Server", "EM-B111X-SATA"),
1520
Commands: baremetal.GetCommands(),
16-
Cmd: "scw baremetal server start zone=nl-ams-1 {{ .Server.ID }}",
21+
Cmd: "scw baremetal server start zone=" + region + " {{ .Server.ID }}",
1722
Check: core.TestCheckCombine(
1823
core.TestCheckGolden(),
1924
core.TestCheckExitCode(1),
@@ -37,9 +42,9 @@ func Test_StartServerErrors(t *testing.T) {
3742

3843
func Test_StopServerErrors(t *testing.T) {
3944
t.Run("Error: cannot be stopped while not delivered", core.Test(&core.TestConfig{
40-
BeforeFunc: createServer("Server"),
45+
BeforeFunc: createServer("Server", "EM-B111X-SATA"),
4146
Commands: baremetal.GetCommands(),
42-
Cmd: "scw baremetal server stop zone=nl-ams-1 {{ .Server.ID }}",
47+
Cmd: "scw baremetal server stop zone=" + region + " {{ .Server.ID }}",
4348
Check: core.TestCheckCombine(
4449
core.TestCheckGolden(),
4550
core.TestCheckExitCode(1),
@@ -63,9 +68,9 @@ func Test_StopServerErrors(t *testing.T) {
6368

6469
func Test_RebootServerErrors(t *testing.T) {
6570
t.Run("Error: cannot be rebooted while not delivered", core.Test(&core.TestConfig{
66-
BeforeFunc: createServer("Server"),
71+
BeforeFunc: createServer("Server", "EM-B111X-SATA"),
6772
Commands: baremetal.GetCommands(),
68-
Cmd: "scw baremetal server reboot zone-nl-ams-1 {{ .Server.ID }}",
73+
Cmd: "scw baremetal server reboot zone=" + region + " {{ .Server.ID }}",
6974
Check: core.TestCheckCombine(
7075
core.TestCheckGolden(),
7176
core.TestCheckExitCode(1),

internal/namespaces/baremetal/v1/helpers_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import (
99
// createServerAndWait creates a baremetal instance
1010
// register it in the context Meta at metaKey.
1111
func createServerAndWait(metaKey string) core.BeforeFunc {
12-
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone=nl-ams-1 type=GP-BM2-S -w")
12+
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone="+region+" type="+offerName+" -w")
1313
}
1414

1515
func createServerAndWaitDefault(metaKey string) core.BeforeFunc {
16-
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create type=EM-B112X-SSD -w")
16+
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create type="+offerName+" -w")
1717
}
1818

19-
func createServer(metaKey string) core.BeforeFunc {
20-
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone=nl-ams-1 type=GP-BM2-S")
19+
func createServer(metaKey string, offerType string) core.BeforeFunc {
20+
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone="+region+" type="+offerType)
2121
}
2222

2323
// deleteServer deletes a server
2424
// previously registered in the context Meta at metaKey.
2525
//
2626
//nolint:unparam
2727
func deleteServer(metaKey string) core.AfterFunc {
28-
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone=nl-ams-1 {{ .%s.ID }}", metaKey))
28+
return core.ExecAfterCmd(fmt.Sprintf("scw baremetal server delete zone="+region+" {{ .%s.ID }}", metaKey))
2929
}
3030

3131
func deleteServerDefault(metaKey string) core.AfterFunc {

0 commit comments

Comments
 (0)