Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,26 @@
version: 1
interactions:
- request:
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374", "name":"macos-sonoma-14",
"label":"macOS Sonoma 14", "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"]}'
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
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"]}'
form: {}
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.22.2; darwin; amd64) cli-e2e-test
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.23.2; darwin; arm64) cli-e2e-test
url: https://api.scaleway.com/apple-silicon/v1alpha1/zones/fr-par-1/os/e08d1e5d-b4b9-402a-9f9a-97732d17e374
method: GET
response:
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374", "name":"macos-sonoma-14",
"label":"macOS Sonoma 14", "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"]}'
body: '{"id":"e08d1e5d-b4b9-402a-9f9a-97732d17e374","name":"macos-sonoma-14.4","label":"macOS
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"]}'
headers:
Content-Length:
- "319"
- "313"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Tue, 11 Jun 2024 08:37:10 GMT
- Wed, 11 Dec 2024 10:57:15 GMT
Server:
- Scaleway API Gateway (fr-par-1;edge02)
Strict-Transport-Security:
Expand All @@ -35,7 +31,7 @@ interactions:
X-Frame-Options:
- DENY
X-Request-Id:
- 08a51853-e9da-4643-aaf8-13d240591fb3
- 99d01325-b45c-45e6-9e05-875caec82c88
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
ID e08d1e5d-b4b9-402a-9f9a-97732d17e374
Name macos-sonoma-14
Label macOS Sonoma 14
Name macos-sonoma-14.4
Label macOS Sonoma 14.4
ImageURL https://scw-apple-silicon.s3.fr-par.scw.cloud/scw-console/os/macos-sonoma.png
Family Sonoma
IsBeta false
Expand All @@ -14,8 +14,8 @@ CompatibleServerTypes:
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
{
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
"name": "macos-sonoma-14",
"label": "macOS Sonoma 14",
"name": "macos-sonoma-14.4",
"label": "macOS 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,40 @@
version: 1
interactions:
- request:
body: ""
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
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
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
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}}]}'
form: {}
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.15.7; darwin; amd64) cli-e2e-test
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.23.2; darwin; arm64) cli-e2e-test
url: https://api.scaleway.com/apple-silicon/v1alpha1/zones/fr-par-1/server-types
method: GET
response:
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"}]}'
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
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
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
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}}]}'
headers:
Content-Length:
- "224"
- "1269"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Fri, 05 Feb 2021 18:04:16 GMT
- Wed, 11 Dec 2024 10:57:16 GMT
Server:
- Scaleway API-Gateway
- Scaleway API Gateway (fr-par-1;edge02)
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- f68db5c3-b1c7-4cb4-98dd-67d6cd32c41a
- 25a5fd08-35cb-41b5-bf40-d101f078726d
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
@@ -1,28 +1,86 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
Name CPU Memory Disk Stock Minimum Lease Duration
M1-M Apple M1 (8 cores) 8.0 GB 256 GB low stock 1 days
Name CPU Memory Disk Stock Minimum Lease Duration
M2-M Apple M2 (8 cores) 16 GB 256 GB high stock 1 days
M2-L Apple M2 Pro (10 cores) 16 GB 512 GB high stock 1 days
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
[
{
"cpu": {
"name": "Apple M1",
"name": "Apple M2",
"core_count": 8,
"frequency": 0
"frequency": 3500000000
},
"disk": {
"capacity": 256000000000,
"type": "SSD"
},
"name": "M1-M",
"name": "M2-M",
"memory": {
"capacity": 8000000000,
"type": "LPDDR4"
"capacity": 16000000000,
"type": "LPDDR5"
},
"stock": "low_stock",
"stock": "high_stock",
"minimum_lease_duration": "86400.000000000s",
"gpu": null,
"network": null,
"default_os": null
"gpu": {
"count": 10
},
"network": {
"public_bandwidth_bps": 1000000000
},
"default_os": {
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
"name": "macos-sonoma-14.4",
"label": "macOS 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,
"version": "14.4",
"xcode_version": "15",
"compatible_server_types": [
"M1-M",
"M2-M",
"M2-L"
]
}
},
{
"cpu": {
"name": "Apple M2 Pro",
"core_count": 10,
"frequency": 3500000000
},
"disk": {
"capacity": 512000000000,
"type": "SSD"
},
"name": "M2-L",
"memory": {
"capacity": 16000000000,
"type": "LPDDR5"
},
"stock": "high_stock",
"minimum_lease_duration": "86400.000000000s",
"gpu": {
"count": 16
},
"network": {
"public_bandwidth_bps": 1000000000
},
"default_os": {
"id": "e08d1e5d-b4b9-402a-9f9a-97732d17e374",
"name": "macos-sonoma-14.4",
"label": "macOS 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,
"version": "14.4",
"xcode_version": "15",
"compatible_server_types": [
"M1-M",
"M2-M",
"M2-L"
]
}
}
]
12 changes: 6 additions & 6 deletions internal/namespaces/baremetal/v1/custom_server_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ func Test_CreateServer(t *testing.T) {
t.Run("Simple", func(t *testing.T) {
t.Run("Default", core.Test(&core.TestConfig{
Commands: baremetal.GetCommands(),
Cmd: "scw baremetal server create zone=fr-par-1 type=EM-B220E-NVME -w",
Cmd: "scw baremetal server create zone=" + region + " type=" + offerName + " -w",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(0),
),
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=fr-par-1"),
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=" + region),
},
))

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

t.Run("Tags", core.Test(&core.TestConfig{
Commands: baremetal.GetCommands(),
Cmd: "scw baremetal server create tags.0=prod tags.1=blue zone=fr-par-1 type=EM-B220E-NVME -w",
Cmd: "scw baremetal server create tags.0=prod tags.1=blue zone=" + region + " type=" + offerName + " -w",
Check: core.TestCheckCombine(
func(t *testing.T, ctx *core.CheckFuncCtx) {
t.Helper()
Expand All @@ -48,7 +48,7 @@ func Test_CreateServer(t *testing.T) {
},
core.TestCheckExitCode(0),
),
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=fr-par-1"),
AfterFunc: core.ExecAfterCmd("scw baremetal server delete {{ .CmdResult.ID }} zone=" + region),
}))
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Test_InstallServer(t *testing.T) {
createServerAndWait("Server"),
),
Commands: cmds,
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",
Cmd: "scw baremetal server install {{ .Server.ID }} zone=" + region + " hostname=test-install-server ssh-key-ids.0={{ .key.ID }} os-id=" + osID + " -w",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(0),
Expand All @@ -40,7 +40,7 @@ func Test_InstallServer(t *testing.T) {
addSSH("key", sshKey),
createServerAndWait("Server"),
),
Cmd: "scw baremetal server install {{ .Server.ID }} zone=nl-ams-1 hostname=test-install-server all-ssh-keys=true os-id=" + osID + " -w",
Cmd: "scw baremetal server install {{ .Server.ID }} zone=" + region + " hostname=test-install-server all-ssh-keys=true os-id=" + osID + " -w",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(0),
Expand Down
17 changes: 11 additions & 6 deletions internal/namespaces/baremetal/v1/custom_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import (
"github.com/scaleway/scaleway-sdk-go/scw"
)

const (
offerName = "EM-B220E-NVME"
region = "fr-par-1"
)

func Test_StartServerErrors(t *testing.T) {
t.Run("Error: cannot be started while not delivered", core.Test(&core.TestConfig{
BeforeFunc: createServer("Server"),
BeforeFunc: createServer("Server", "EM-B111X-SATA"),
Commands: baremetal.GetCommands(),
Cmd: "scw baremetal server start zone=nl-ams-1 {{ .Server.ID }}",
Cmd: "scw baremetal server start zone=" + region + " {{ .Server.ID }}",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(1),
Expand All @@ -37,9 +42,9 @@ func Test_StartServerErrors(t *testing.T) {

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

func Test_RebootServerErrors(t *testing.T) {
t.Run("Error: cannot be rebooted while not delivered", core.Test(&core.TestConfig{
BeforeFunc: createServer("Server"),
BeforeFunc: createServer("Server", "EM-B111X-SATA"),
Commands: baremetal.GetCommands(),
Cmd: "scw baremetal server reboot zone-nl-ams-1 {{ .Server.ID }}",
Cmd: "scw baremetal server reboot zone=" + region + " {{ .Server.ID }}",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(1),
Expand Down
10 changes: 5 additions & 5 deletions internal/namespaces/baremetal/v1/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import (
// createServerAndWait creates a baremetal instance
// register it in the context Meta at metaKey.
func createServerAndWait(metaKey string) core.BeforeFunc {
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone=nl-ams-1 type=GP-BM2-S -w")
return core.ExecStoreBeforeCmd(metaKey, "scw baremetal server create zone="+region+" type="+offerName+" -w")
}

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

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

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

func deleteServerDefault(metaKey string) core.AfterFunc {
Expand Down
Loading
Loading