Skip to content

Commit

Permalink
Remove the check of volume type in the root volume validation
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilb-scaleway authored and clement-gilbert committed Feb 23, 2022
1 parent e2b1923 commit c8ad2f6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
4 changes: 0 additions & 4 deletions internal/namespaces/instance/v1/custom_server_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,6 @@ func validateRootVolume(imageRequiredSize scw.Size, rootVolume *instance.VolumeS
return nil
}

if rootVolume.VolumeType != instance.VolumeVolumeTypeLSSD {
return fmt.Errorf("first volume must be local")
}

if rootVolume.ID != "" {
return &core.CliError{
Err: fmt.Errorf("you cannot use an existing volume as a root volume"),
Expand Down
20 changes: 10 additions & 10 deletions internal/namespaces/instance/v1/custom_server_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ func Test_CreateServerErrors(t *testing.T) {
DisableParallel: true,
}))

t.Run("Error: invalid total local volumes size: too low 3", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw instance server create image=ubuntu_bionic root-volume=block:20GB",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(1),
),
DisableParallel: true,
}))

t.Run("Error: invalid total local volumes size: too high 1", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw instance server create image=ubuntu_bionic root-volume=local:10GB additional-volumes.0=local:20GB",
Expand Down Expand Up @@ -329,16 +339,6 @@ func Test_CreateServerErrors(t *testing.T) {
DisableParallel: true,
}))

t.Run("Error: invalid root volume type", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw instance server create image=ubuntu_bionic root-volume=block:20GB",
Check: core.TestCheckCombine(
core.TestCheckGolden(),
core.TestCheckExitCode(1),
),
DisableParallel: true,
}))

t.Run("Error: disallow existing root volume ID", core.Test(&core.TestConfig{
Commands: GetCommands(),
BeforeFunc: createVolume("Volume", 20, instance.VolumeVolumeTypeLSSD),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
🎲🎲🎲 EXIT CODE: 1 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
First volume must be local
DEV1-S total local volume size must be equal to 20 GB
🟥🟥🟥 JSON STDERR 🟥🟥🟥
{
"error": "first volume must be local"
"error": "DEV1-S total local volume size must be equal to 20 GB"
}

0 comments on commit c8ad2f6

Please sign in to comment.