Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(instance): remove hardcoded offers #2785

Merged
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 @@ -36,7 +36,7 @@ EXAMPLES:

ARGS:
image=ubuntu_jammy Image ID or label of the server
type=DEV1-S Server commercial type (help: https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/)
type Server commercial type (help: https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/)
[name=<generated>] Server name
[root-volume] Local root volume of the server
[additional-volumes.{index}] Additional local and block volumes attached to your server
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ scw instance server create [arg=value ...]
| Name | | Description |
|------|---|-------------|
| image | Required<br />Default: `ubuntu_jammy` | Image ID or label of the server |
| type | Required<br />Default: `DEV1-S` | Server commercial type (help: https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/) |
| type | Required | Server commercial type (help: https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/) |
| name | Default: `<generated>` | Server name |
| root-volume | | Local root volume of the server |
| additional-volumes.{index} | | Additional local and block volumes attached to your server |
Expand Down
2 changes: 1 addition & 1 deletion internal/namespaces/instance/v1/custom_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Test_ImageCreate(t *testing.T) {
t.Run("Use additional snapshots", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("Server", "scw instance server create image=ubuntu_focal root-volume=local:10GB additional-volumes.0=local:10GB -w"),
core.ExecStoreBeforeCmd("Server", "scw instance server create type=DEV1-S image=ubuntu_focal root-volume=local:10GB additional-volumes.0=local:10GB -w"),
core.ExecStoreBeforeCmd("SnapshotA", `scw instance snapshot create -w name=cli-test-image-create-snapshotA volume-id={{ (index .Server.Volumes "0").ID }}`),
core.ExecStoreBeforeCmd("SnapshotB", `scw instance snapshot create -w name=cli-test-image-create-snapshotB volume-id={{ (index .Server.Volumes "1").ID }}`),
),
Expand Down
8 changes: 4 additions & 4 deletions internal/namespaces/instance/v1/custom_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func Test_IPAttach(t *testing.T) {
t.Run("With UUID", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true ip=none"),
core.ExecStoreBeforeCmd("Server", "scw instance server create type=DEV1-S stopped=true ip=none"),
createIP("Ip"),
),
Cmd: "scw instance ip attach {{ .Ip.Address }} server-id={{ .Server.ID }}",
Expand All @@ -28,7 +28,7 @@ func Test_IPAttach(t *testing.T) {
t.Run("With IP", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true ip=none"),
core.ExecStoreBeforeCmd("Server", "scw instance server create type=DEV1-S stopped=true ip=none"),
createIP("Ip"),
),
Cmd: "scw instance ip attach {{ .Ip.Address }} server-id={{ .Server.ID }}",
Expand All @@ -47,7 +47,7 @@ func Test_IPDetach(t *testing.T) {
t.Run("With UUID", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true ip=none"),
core.ExecStoreBeforeCmd("Server", "scw instance server create type=DEV1-S stopped=true ip=none"),
createIP("Ip"),
core.ExecBeforeCmd("scw instance ip attach {{ .Ip.Address }} server-id={{ .Server.ID }}"),
),
Expand All @@ -66,7 +66,7 @@ func Test_IPDetach(t *testing.T) {
t.Run("With IP", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true ip=none"),
core.ExecStoreBeforeCmd("Server", "scw instance server create type=DEV1-S stopped=true ip=none"),
createIP("Ip"),
core.ExecBeforeCmd("scw instance ip attach {{ .Ip.Address }} server-id={{ .Server.ID }}"),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func Test_GetPlacementGroup(t *testing.T) {
t.Run("simple", core.Test(&core.TestConfig{
BeforeFunc: core.BeforeFuncCombine(
core.ExecStoreBeforeCmd("PlacementGroup", "scw instance placement-group create"),
core.ExecStoreBeforeCmd("ServerA", "scw instance server create image=ubuntu_jammy stopped=true placement-group-id={{ .PlacementGroup.PlacementGroup.ID }}"),
core.ExecStoreBeforeCmd("ServerA", "scw instance server create type=DEV1-S image=ubuntu_jammy stopped=true placement-group-id={{ .PlacementGroup.PlacementGroup.ID }}"),
),
Commands: instance.GetCommands(),
Cmd: "scw instance placement-group get {{ .PlacementGroup.PlacementGroup.ID }}",
Expand Down
12 changes: 6 additions & 6 deletions internal/namespaces/instance/v1/custom_server_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_ServerTerminate(t *testing.T) {

t.Run("without IP", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create image=ubuntu-jammy -w"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("image=ubuntu-jammy -w")),
Cmd: `scw instance server terminate {{ .Server.ID }}`,
Check: core.TestCheckCombine(
core.TestCheckGolden(),
Expand All @@ -40,7 +40,7 @@ func Test_ServerTerminate(t *testing.T) {

t.Run("with IP", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create image=ubuntu-jammy -w"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("image=ubuntu-jammy -w")),
Cmd: `scw instance server terminate {{ .Server.ID }} with-ip=true`,
Check: core.TestCheckCombine(
core.TestCheckGolden(),
Expand All @@ -61,7 +61,7 @@ func Test_ServerTerminate(t *testing.T) {

t.Run("without block", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create image=ubuntu-jammy additional-volumes.0=block:10G -w"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("image=ubuntu-jammy additional-volumes.0=block:10G -w")),
Cmd: `scw instance server terminate {{ .Server.ID }} with-ip=true with-block=false`,
Check: core.TestCheckCombine(
core.TestCheckGolden(),
Expand All @@ -76,7 +76,7 @@ func Test_ServerTerminate(t *testing.T) {

t.Run("with block", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create image=ubuntu-jammy additional-volumes.0=block:10G -w"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("image=ubuntu-jammy additional-volumes.0=block:10G -w")),
Cmd: `scw instance server terminate {{ .Server.ID }} with-ip=true with-block=true -w`,
Check: core.TestCheckCombine(
core.TestCheckGolden(),
Expand All @@ -103,7 +103,7 @@ func Test_ServerTerminate(t *testing.T) {
func Test_ServerBackup(t *testing.T) {
t.Run("simple", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true image=ubuntu-jammy"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("stopped=true image=ubuntu-jammy")),
Cmd: `scw instance server backup {{ .Server.ID }} name=backup`,
Check: core.TestCheckCombine(
core.TestCheckGolden(),
Expand All @@ -119,7 +119,7 @@ func Test_ServerBackup(t *testing.T) {
func Test_ServerAction(t *testing.T) {
t.Run("manual poweron", core.Test(&core.TestConfig{
Commands: instance.GetCommands(),
BeforeFunc: core.ExecStoreBeforeCmd("Server", "scw instance server create stopped=true image=ubuntu_jammy"),
BeforeFunc: core.ExecStoreBeforeCmd("Server", testServerCommand("stopped=true image=ubuntu_jammy")),
Cmd: `scw instance server action {{ .Server.ID }} action=poweron --wait`,
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
Expand Down
1 change: 0 additions & 1 deletion internal/namespaces/instance/v1/custom_server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func serverCreateCommand() *core.Command {
{
Name: "type",
Short: "Server commercial type (help: https://www.scaleway.com/en/docs/compute/instances/reference-content/choosing-instance-type/)",
Default: core.DefaultValueSetter("DEV1-S"),
Required: true,
ValidateFunc: func(_ *core.ArgSpec, _ interface{}) error {
// Allow all commercial types
Expand Down
Loading
Loading