forked from scaleway/scaleway-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
baremetal: migrate to v1 (scaleway#1039)
- Loading branch information
Showing
55 changed files
with
7,026 additions
and
8,849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
cmd/scw/testdata/test-all-usage-baremetal-server-wait-usage.stderr.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
...l/namespaces/baremetal/v1alpha1/custom.go → internal/namespaces/baremetal/v1/custom.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package baremetal | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/scaleway/scaleway-cli/internal/core" | ||
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v1" | ||
"github.com/scaleway/scaleway-sdk-go/scw" | ||
) | ||
|
||
func Test_StartServerErrors(t *testing.T) { | ||
t.Run("Error: cannot be started while not delivered", core.Test(&core.TestConfig{ | ||
BeforeFunc: createServer("Server"), | ||
Commands: GetCommands(), | ||
Cmd: "scw baremetal server start {{ .Server.ID }}", | ||
Check: core.TestCheckCombine( | ||
core.TestCheckGolden(), | ||
core.TestCheckExitCode(1), | ||
), | ||
AfterFunc: core.AfterFuncCombine( | ||
func(ctx *core.AfterFuncCtx) error { | ||
api := baremetal.NewAPI(ctx.Client) | ||
server := ctx.Meta["Server"].(*baremetal.Server) | ||
server, err := api.WaitForServer(&baremetal.WaitForServerRequest{ | ||
ServerID: server.ID, | ||
Zone: server.Zone, | ||
Timeout: serverActionTimeout, | ||
RetryInterval: defaultRetryInterval, | ||
}) | ||
return err | ||
}, | ||
deleteServer("Server"), | ||
), | ||
DefaultZone: scw.ZoneFrPar2, | ||
})) | ||
} | ||
|
||
func Test_StopServerErrors(t *testing.T) { | ||
t.Run("Error: cannot be stopped while not delivered", core.Test(&core.TestConfig{ | ||
BeforeFunc: createServer("Server"), | ||
Commands: GetCommands(), | ||
Cmd: "scw baremetal server stop {{ .Server.ID }}", | ||
Check: core.TestCheckCombine( | ||
core.TestCheckGolden(), | ||
core.TestCheckExitCode(1), | ||
), | ||
AfterFunc: core.AfterFuncCombine( | ||
func(ctx *core.AfterFuncCtx) error { | ||
api := baremetal.NewAPI(ctx.Client) | ||
server := ctx.Meta["Server"].(*baremetal.Server) | ||
server, err := api.WaitForServer(&baremetal.WaitForServerRequest{ | ||
ServerID: server.ID, | ||
Zone: server.Zone, | ||
Timeout: serverActionTimeout, | ||
RetryInterval: defaultRetryInterval, | ||
}) | ||
return err | ||
}, | ||
deleteServer("Server"), | ||
), | ||
DefaultZone: scw.ZoneFrPar2, | ||
})) | ||
} | ||
|
||
func Test_RebootServerErrors(t *testing.T) { | ||
t.Run("Error: cannot be rebooted while not delivered", core.Test(&core.TestConfig{ | ||
BeforeFunc: createServer("Server"), | ||
Commands: GetCommands(), | ||
Cmd: "scw baremetal server reboot {{ .Server.ID }}", | ||
Check: core.TestCheckCombine( | ||
core.TestCheckGolden(), | ||
core.TestCheckExitCode(1), | ||
), | ||
AfterFunc: core.AfterFuncCombine( | ||
func(ctx *core.AfterFuncCtx) error { | ||
api := baremetal.NewAPI(ctx.Client) | ||
server := ctx.Meta["Server"].(*baremetal.Server) | ||
server, err := api.WaitForServer(&baremetal.WaitForServerRequest{ | ||
ServerID: server.ID, | ||
Zone: server.Zone, | ||
Timeout: serverActionTimeout, | ||
RetryInterval: defaultRetryInterval, | ||
}) | ||
return err | ||
}, | ||
deleteServer("Server"), | ||
), | ||
DefaultZone: scw.ZoneFrPar2, | ||
})) | ||
} |
Oops, something went wrong.