Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone committed Mar 17, 2020
1 parent fa4edc4 commit 59dfff3
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func Test_CreateServer(t *testing.T) {
t.Run("Simple", func(t *testing.T) {
t.Run("Default", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw baremetal server create",
Cmd: "scw baremetal server create zone=fr-par-2",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(0),
),
AfterFunc: deleteServerAfterFunc,
//AfterFunc: deleteServerAfterFunc,
DefaultZone: scw.ZoneFrPar2,
}))

Expand All @@ -39,25 +39,27 @@ func Test_CreateServer(t *testing.T) {
},
core.TestCheckExitCode(0),
),
AfterFunc: deleteServerAfterFunc,
DefaultZone: scw.ZoneFrPar2,
//AfterFunc: deleteServerAfterFunc,
}))

t.Run("Tags", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw baremetal server create tags.0=prod tags.1=blue",
Cmd: "scw baremetal server create tags.0=prod tags.1=blue zone=fr-par-2",
Check: core.TestCheckCombine(
func(t *testing.T, ctx *core.CheckFuncCtx) {
assert.Equal(t, "prod", ctx.Result.(*baremetal.Server).Tags[0])
assert.Equal(t, "blue", ctx.Result.(*baremetal.Server).Tags[1])
},
core.TestCheckExitCode(0),
),
AfterFunc: deleteServerAfterFunc,
DefaultZone: scw.ZoneFrPar2,
//AfterFunc: deleteServerAfterFunc,
}))

//t.Run("HC-BM1-L", core.Test(&core.TestConfig{
// Commands: GetCommands(),
// Cmd: "scw baremetal server create type=HC-BM1-L",
// Cmd: "scw baremetal server create type=HC-BM1-L zone=fr-par-2",
// Check: core.TestCheckCombine(
// func(t *testing.T, ctx *core.CheckFuncCtx) {
// assert.Equal(t, "HC-BM1-L", ctx.Result.(*baremetal.Server).CommercialType)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unknown command "instance" for "scw"
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ interactions:
response:
body: '{"total_count":6,"offers":[{"id":"3ab0dc29-2fd4-486e-88bf-d08fbf49214b","name":"HC-BM1-L","stock":"available","bandwidth":1000,"commercial_range":"high_cpu","price_by_minute":{"currency_code":"EUR","units":1,"nanos":499900000},"price_by_month":{"currency_code":"EUR","units":749,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel
Xeon Gold 5120","cores":28,"threads":56,"frequency":2200},{"name":"Intel Xeon
Gold 5120","cores":28,"threads":56,"frequency":2200}],"memory":[{"capacity":384,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":1,"nanos":499900000},"price_per_month":{"currency_code":"EUR","units":749,"nanos":990000000}},{"id":"5363865f-2266-40f9-a43f-4f3aba251524","name":"HM-BM1-XL","stock":"empty","bandwidth":1000,"commercial_range":"high_memory","price_by_minute":{"currency_code":"EUR","units":2,"nanos":599900000},"price_by_month":{"currency_code":"EUR","units":1299,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel
Gold 5120","cores":28,"threads":56,"frequency":2200}],"memory":[{"capacity":384,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":1,"nanos":499900000},"price_per_month":{"currency_code":"EUR","units":749,"nanos":990000000}},{"id":"5363865f-2266-40f9-a43f-4f3aba251524","name":"HM-BM1-XL","stock":"available","bandwidth":1000,"commercial_range":"high_memory","price_by_minute":{"currency_code":"EUR","units":2,"nanos":599900000},"price_by_month":{"currency_code":"EUR","units":1299,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel
Xeon Gold 6140","cores":36,"threads":72,"frequency":2300},{"name":"Intel Xeon
Gold 6140","cores":36,"threads":72,"frequency":2300}],"memory":[{"capacity":768,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":2,"nanos":599900000},"price_per_month":{"currency_code":"EUR","units":1299,"nanos":990000000}},{"id":"737f18c8-febc-4408-b69e-776bca0a3f48","name":"HC-BM1-S","stock":"available","bandwidth":1000,"commercial_range":"high_cpu","price_by_minute":{"currency_code":"EUR","units":0,"nanos":659900000},"price_by_month":{"currency_code":"EUR","units":329,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel
Xeon Silver 4114","cores":10,"threads":20,"frequency":2200},{"name":"Intel Xeon
Silver 4114","cores":10,"threads":20,"frequency":2200}],"memory":[{"capacity":128,"type":"DDR4","frequency":2400,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":659900000},"price_per_month":{"currency_code":"EUR","units":329,"nanos":990000000}},{"id":"8090d302-3545-4905-9cf3-bcb77a299f47","name":"GP-BM1-L","stock":"available","bandwidth":1000,"commercial_range":"general_purpose","price_by_minute":{"currency_code":"EUR","units":0,"nanos":499900000},"price_by_month":{"currency_code":"EUR","units":249,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"AMD
Silver 4114","cores":10,"threads":20,"frequency":2200}],"memory":[{"capacity":128,"type":"DDR4","frequency":2400,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":659900000},"price_per_month":{"currency_code":"EUR","units":329,"nanos":990000000}},{"id":"8090d302-3545-4905-9cf3-bcb77a299f47","name":"GP-BM1-L","stock":"available","bandwidth":750,"commercial_range":"general_purpose","price_by_minute":{"currency_code":"EUR","units":0,"nanos":499900000},"price_by_month":{"currency_code":"EUR","units":249,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"AMD
EPYC 7281","cores":16,"threads":32,"frequency":2100}],"memory":[{"capacity":96,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_gp","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":499900000},"price_per_month":{"currency_code":"EUR","units":249,"nanos":990000000}},{"id":"964f9b38-577e-470f-a220-7d762f9e8672","name":"GP-BM1-M","stock":"available","bandwidth":500,"commercial_range":"general_purpose","price_by_minute":{"currency_code":"EUR","units":0,"nanos":399900000},"price_by_month":{"currency_code":"EUR","units":199,"nanos":990000000},"disk":[{"capacity":1024,"type":"SSD"},{"capacity":1024,"type":"SSD"},{"capacity":1024,"type":"SSD"}],"enable":true,"cpu":[{"name":"Intel
Xeon E3 1240v6","cores":4,"threads":8,"frequency":3700}],"memory":[{"capacity":64,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_gp","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":399900000},"price_per_month":{"currency_code":"EUR","units":199,"nanos":990000000}},{"id":"c452f76a-2cda-4a1b-9658-a16952dc5ff0","name":"HM-BM1-M","stock":"available","bandwidth":1000,"commercial_range":"high_memory","price_by_minute":{"currency_code":"EUR","units":0,"nanos":799900000},"price_by_month":{"currency_code":"EUR","units":399,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"AMD
EPYC 7401P","cores":24,"threads":48,"frequency":2000}],"memory":[{"capacity":256,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":799900000},"price_per_month":{"currency_code":"EUR","units":399,"nanos":990000000}}]}'
Expand All @@ -26,7 +26,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 16 Mar 2020 15:02:43 GMT
- Tue, 17 Mar 2020 15:00:14 GMT
Server:
- scaleway_api
Strict-Transport-Security:
Expand All @@ -36,12 +36,12 @@ interactions:
X-Frame-Options:
- DENY
X-Request-Id:
- 5439d8ff-9e6b-4d35-b4bc-9804ab319959
- 8ff5663b-c7e8-4b5f-8d67-a8b0b33ef4a2
status: 200 OK
code: 200
duration: ""
- request:
body: '{"offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-adoring-burnell","description":"","tags":null}'
body: '{"offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-mystifying-shannon","description":"","tags":null}'
form: {}
headers:
Content-Type:
Expand All @@ -51,16 +51,16 @@ interactions:
url: https://api.scaleway.com/baremetal/v1alpha1/zones/fr-par-2/servers
method: POST
response:
body: '{"id":"56443f14-77a3-47f9-9468-972be70d20fa","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-adoring-burnell","description":"","updated_at":"2020-03-16T15:02:44.095279868Z","created_at":"2020-03-16T15:02:44.095279868Z","status":"undelivered","offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","install":null,"tags":[],"ips":[],"domain":"","boot_type":"normal","zone":"fr-par-2"}'
body: '{"id":"2bc82be8-aeb4-4cf3-a474-954c5abf7d3b","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-mystifying-shannon","description":"","updated_at":"2020-03-17T15:00:15.123704001Z","created_at":"2020-03-17T15:00:15.123704001Z","status":"undelivered","offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","install":null,"tags":[],"ips":[],"domain":"","boot_type":"normal","zone":"fr-par-2"}'
headers:
Content-Length:
- "401"
- "404"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Mon, 16 Mar 2020 15:02:43 GMT
- Tue, 17 Mar 2020 15:00:14 GMT
Server:
- scaleway_api
Strict-Transport-Security:
Expand All @@ -70,39 +70,7 @@ interactions:
X-Frame-Options:
- DENY
X-Request-Id:
- 0cdd8d80-4368-453b-9134-e7ce105fd41f
- 08cd5b27-ee60-44fd-94c9-45c7a7f3b501
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.6+dev (go1.14; darwin; amd64) cli-e2e-test
url: https://api.scaleway.com/baremetal/v1alpha1/zones/fr-par-2/servers/56443f14-77a3-47f9-9468-972be70d20fa
method: DELETE
response:
body: '{"message":"Server is not delivered"}'
headers:
Content-Length:
- "37"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Mon, 16 Mar 2020 15:02:43 GMT
Server:
- scaleway_api
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- 11f38363-ebdc-46a9-acd9-8f04c50fed03
status: 400 Bad Request
code: 400
duration: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
DEBUG: 2019/12/09 16:04:07 creating GET request on https://api.scaleway.com/baremetal/v1alpha1/zones/fr-par-2/offers?page=1
DEBUG: 2019/12/09 16:04:07
--------------- Scaleway SDK REQUEST 1 : ---------------
GET /baremetal/v1alpha1/zones/fr-par-2/offers?page=1 HTTP/1.1
Host: api.scaleway.com
User-Agent: scaleway-sdk-go/v1.0.0-beta.6+dev (go1.14; darwin; amd64) cli-e2e-test
X-Auth-Token: 148499e0-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Accept-Encoding: gzip


---------------------------------------------------------
DEBUG: 2019/12/09 16:04:07
--------------- Scaleway SDK RESPONSE 1 : ---------------
HTTP/1.0 200 OK
Connection: close
Content-Length: 4684
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'
Content-Type: application/json
Date: Tue, 17 Mar 2020 15:00:14 GMT
Server: scaleway_api
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 8ff5663b-c7e8-4b5f-8d67-a8b0b33ef4a2

{"total_count":6,"offers":[{"id":"3ab0dc29-2fd4-486e-88bf-d08fbf49214b","name":"HC-BM1-L","stock":"available","bandwidth":1000,"commercial_range":"high_cpu","price_by_minute":{"currency_code":"EUR","units":1,"nanos":499900000},"price_by_month":{"currency_code":"EUR","units":749,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel Xeon Gold 5120","cores":28,"threads":56,"frequency":2200},{"name":"Intel Xeon Gold 5120","cores":28,"threads":56,"frequency":2200}],"memory":[{"capacity":384,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":1,"nanos":499900000},"price_per_month":{"currency_code":"EUR","units":749,"nanos":990000000}},{"id":"5363865f-2266-40f9-a43f-4f3aba251524","name":"HM-BM1-XL","stock":"available","bandwidth":1000,"commercial_range":"high_memory","price_by_minute":{"currency_code":"EUR","units":2,"nanos":599900000},"price_by_month":{"currency_code":"EUR","units":1299,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel Xeon Gold 6140","cores":36,"threads":72,"frequency":2300},{"name":"Intel Xeon Gold 6140","cores":36,"threads":72,"frequency":2300}],"memory":[{"capacity":768,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":2,"nanos":599900000},"price_per_month":{"currency_code":"EUR","units":1299,"nanos":990000000}},{"id":"737f18c8-febc-4408-b69e-776bca0a3f48","name":"HC-BM1-S","stock":"available","bandwidth":1000,"commercial_range":"high_cpu","price_by_minute":{"currency_code":"EUR","units":0,"nanos":659900000},"price_by_month":{"currency_code":"EUR","units":329,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"Intel Xeon Silver 4114","cores":10,"threads":20,"frequency":2200},{"name":"Intel Xeon Silver 4114","cores":10,"threads":20,"frequency":2200}],"memory":[{"capacity":128,"type":"DDR4","frequency":2400,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":659900000},"price_per_month":{"currency_code":"EUR","units":329,"nanos":990000000}},{"id":"8090d302-3545-4905-9cf3-bcb77a299f47","name":"GP-BM1-L","stock":"available","bandwidth":750,"commercial_range":"general_purpose","price_by_minute":{"currency_code":"EUR","units":0,"nanos":499900000},"price_by_month":{"currency_code":"EUR","units":249,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"AMD EPYC 7281","cores":16,"threads":32,"frequency":2100}],"memory":[{"capacity":96,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_gp","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":499900000},"price_per_month":{"currency_code":"EUR","units":249,"nanos":990000000}},{"id":"964f9b38-577e-470f-a220-7d762f9e8672","name":"GP-BM1-M","stock":"available","bandwidth":500,"commercial_range":"general_purpose","price_by_minute":{"currency_code":"EUR","units":0,"nanos":399900000},"price_by_month":{"currency_code":"EUR","units":199,"nanos":990000000},"disk":[{"capacity":1024,"type":"SSD"},{"capacity":1024,"type":"SSD"},{"capacity":1024,"type":"SSD"}],"enable":true,"cpu":[{"name":"Intel Xeon E3 1240v6","cores":4,"threads":8,"frequency":3700}],"memory":[{"capacity":64,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_gp","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":399900000},"price_per_month":{"currency_code":"EUR","units":199,"nanos":990000000}},{"id":"c452f76a-2cda-4a1b-9658-a16952dc5ff0","name":"HM-BM1-M","stock":"available","bandwidth":1000,"commercial_range":"high_memory","price_by_minute":{"currency_code":"EUR","units":0,"nanos":799900000},"price_by_month":{"currency_code":"EUR","units":399,"nanos":990000000},"disk":[{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"},{"capacity":1024,"type":"NVMe"}],"enable":true,"cpu":[{"name":"AMD EPYC 7401P","cores":24,"threads":48,"frequency":2000}],"memory":[{"capacity":256,"type":"DDR4","frequency":2133,"ecc":true}],"quota_name":"bmaas_high","price_per_sixty_minutes":{"currency_code":"EUR","units":0,"nanos":799900000},"price_per_month":{"currency_code":"EUR","units":399,"nanos":990000000}}]}
----------------------------------------------------------
DEBUG: 2019/12/09 16:04:07 creating POST request on https://api.scaleway.com/baremetal/v1alpha1/zones/fr-par-2/servers
DEBUG: 2019/12/09 16:04:07
--------------- Scaleway SDK REQUEST 2 : ---------------
POST /baremetal/v1alpha1/zones/fr-par-2/servers HTTP/1.1
Host: api.scaleway.com
User-Agent: scaleway-sdk-go/v1.0.0-beta.6+dev (go1.14; darwin; amd64) cli-e2e-test
Content-Length: 172
Content-Type: application/json
X-Auth-Token: 148499e0-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Accept-Encoding: gzip

{"offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-mystifying-shannon","description":"","tags":null}
---------------------------------------------------------
DEBUG: 2019/12/09 16:04:07
--------------- Scaleway SDK RESPONSE 2 : ---------------
HTTP/1.0 200 OK
Connection: close
Content-Length: 404
Content-Security-Policy: default-src 'none'; frame-ancestors 'none'
Content-Type: application/json
Date: Tue, 17 Mar 2020 15:00:14 GMT
Server: scaleway_api
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 08cd5b27-ee60-44fd-94c9-45c7a7f3b501

{"id":"2bc82be8-aeb4-4cf3-a474-954c5abf7d3b","organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42","name":"cli-bm-mystifying-shannon","description":"","updated_at":"2020-03-17T15:00:15.123704001Z","created_at":"2020-03-17T15:00:15.123704001Z","status":"undelivered","offer_id":"964f9b38-577e-470f-a220-7d762f9e8672","install":null,"tags":[],"ips":[],"domain":"","boot_type":"normal","zone":"fr-par-2"}
----------------------------------------------------------
DEBUG: 2019/12/09 16:04:07 marshalling type '*baremetal.Server'
DEBUG: 2019/12/09 16:04:07 marshalling type 'baremetal.Server'
DEBUG: 2019/12/09 16:04:07 skipping check version
DEBUG: 2019/12/09 16:04:07 skipping telemetry report
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id 56443f14-77a3-47f9-9468-972be70d20fa
id 2bc82be8-aeb4-4cf3-a474-954c5abf7d3b
organization-id 951df375-e094-4d26-97c1-ba548eeb9c42
name cli-bm-adoring-burnell
name cli-bm-mystifying-shannon
description -
updated-at few seconds ago
created-at few seconds ago
Expand Down
Loading

0 comments on commit 59dfff3

Please sign in to comment.