Skip to content

Commit

Permalink
Merge branch 'master' into v1.6116.0
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone authored Feb 18, 2025
2 parents b41ad44 + b248b68 commit 1a61e7a
Show file tree
Hide file tree
Showing 60 changed files with 1,970 additions and 2,085 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build and push CLI doc to S3
on:
workflow_dispatch:
release:
types:
- published # Triggered only when a new release is published
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARGS:
[type] Create a server of the given type
[os-id] Create a server with the given os_id
[enable-vpc] Activate the Private Network feature for this server
[commitment-type] Activate commitment for this server (duration_24h | renewed_monthly | none)
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-3)

FLAGS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ USAGE:
scw apple-silicon server update <server-id ...> [arg=value ...]

ARGS:
server-id UUID of the server you want to update
[name] Updated name for your server
[schedule-deletion] Specify whether the server should be flagged for automatic deletion
[enable-vpc] Activate or deactivate Private Network support for this server
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-3)
server-id UUID of the server you want to update
[name] Updated name for your server
[schedule-deletion] Specify whether the server should be flagged for automatic deletion
[enable-vpc] Activate or deactivate Private Network support for this server
[commitment-type.commitment-type] (duration_24h | renewed_monthly | none)
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-3)

FLAGS:
-h, --help help for update
Expand Down
2 changes: 1 addition & 1 deletion core/alias_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package core_test
import (
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/alias"
"github.com/stretchr/testify/assert"
)

func TestCommandMatchAlias(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/arg_specs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package core_test
import (
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/stretchr/testify/assert"
)

func TestOneOf(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"reflect"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/args"
"github.com/scaleway/scaleway-cli/v2/internal/interactive"
"github.com/stretchr/testify/assert"
)

func TestInterruptError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/build_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"
"time"

"github.com/alecthomas/assert"
"github.com/hashicorp/go-version"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/args"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion core/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"testing"
"time"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/stretchr/testify/assert"
)

func TestCheckAPIKey(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/cobra_usage_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/stretchr/testify/assert"
)

type ServerColor string
Expand Down
2 changes: 1 addition & 1 deletion core/command_interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/stretchr/testify/assert"
)

func Test_CombineCommandInterceptor(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/args"
"github.com/stretchr/testify/assert"
)

func Test_ApplyDefaultValues(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions core/human/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"testing"
"time"

"github.com/alecthomas/assert"
"github.com/dustin/go-humanize"
"github.com/scaleway/scaleway-cli/v2/core/human"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

type Struct struct {
Expand Down Expand Up @@ -85,10 +86,8 @@ func TestMarshal(t *testing.T) {
expected = strings.Trim(expected, "\n")

if tc.result != "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, expected, result)
} else {
assert.Equal(t, err, err)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strings"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/stretchr/testify/assert"
)

type RequestEmbedding struct {
Expand Down Expand Up @@ -161,7 +161,7 @@ func Test_getValuesForFieldByName(t *testing.T) {
t.Helper()
values, err := core.GetValuesForFieldByName(reflect.ValueOf(tc.cmdArgs), strings.Split(tc.fieldName, "."))
if err != nil {
assert.Equal(t, nil, err.Error())
assert.Nil(t, err.Error())
} else if tc.expectedValues != nil && !reflect.DeepEqual(tc.expectedValues[0].Interface(), values[0].Interface()) {
t.Errorf("Expected %v, got %v", tc.expectedValues[0].Interface(), values[0].Interface())
}
Expand Down
2 changes: 1 addition & 1 deletion core/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package core_test
import (
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/stretchr/testify/assert"
)

func TestShell_OptionToArgSpecName(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/testing_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"
"testing"

"github.com/alecthomas/assert"
"github.com/dnaeon/go-vcr/cassette"
"github.com/dnaeon/go-vcr/recorder"
"github.com/stretchr/testify/assert"
)

func cassetteRequestFilter(i *cassette.Interaction) error {
Expand Down
7 changes: 4 additions & 3 deletions core/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"regexp"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestGoldenIgnoreLines(t *testing.T) {
Expand All @@ -21,7 +22,7 @@ Line4`
Pattern: regexp.MustCompile("Line2\nLine3\n"),
Replacement: "",
})
assert.Nil(t, err)
require.NoError(t, err)
assert.Equal(t, expected, actual)

expected2 := `
Expand All @@ -34,6 +35,6 @@ Line1`
Pattern: regexp.MustCompile("(?s)(Line1).*(Line2).*(Line3).*(Line4)"),
Replacement: "$4\n$3\n$2\n$1",
})
assert.Nil(t, err)
require.NoError(t, err)
assert.Equal(t, expected2, actual2)
}
11 changes: 5 additions & 6 deletions core/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package core_test
import (
"context"
"errors"
"fmt"
"reflect"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/args"
"github.com/stretchr/testify/assert"
)

type Element struct {
Expand Down Expand Up @@ -200,7 +199,7 @@ func Test_DefaultCommandRequiredFunc(t *testing.T) {
return func(t *testing.T) {
t.Helper()
err := core.DefaultCommandValidateFunc()(context.Background(), testCase.command, testCase.parsedArguments, testCase.rawArgs)
assert.Equal(t, nil, err)
assert.NoError(t, err)
}
}

Expand Down Expand Up @@ -306,7 +305,7 @@ func Test_ValidateNoConflict(t *testing.T) {
return func(t *testing.T) {
t.Helper()
err := core.ValidateNoConflict(testCase.command, testCase.rawArgs)
assert.Equal(t, nil, err)
assert.NoError(t, err)
}
}

Expand Down Expand Up @@ -551,7 +550,7 @@ func TestValidateRequiredOneOfGroups(t *testing.T) {
if tt.expectedError == "" {
assert.NoError(t, err, "Expected no error, got %v", err)
} else {
assert.EqualError(t, err, tt.expectedError, fmt.Sprintf("Expected error message '%s', got '%v'", tt.expectedError, err))
assert.EqualError(t, err, tt.expectedError, "Expected error message '%s', got '%v'", tt.expectedError, err)
}
})
}
Expand Down Expand Up @@ -696,7 +695,7 @@ func TestValidateUniqueOneOfGroups(t *testing.T) {
if tt.expectedError == "" {
assert.NoError(t, err, "Expected no error, got %v", err)
} else {
assert.EqualError(t, err, tt.expectedError, fmt.Sprintf("Expected error message '%s', got '%v'", tt.expectedError, err))
assert.EqualError(t, err, tt.expectedError, "Expected error message '%s', got '%v'", tt.expectedError, err)
}
})
}
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/apple-silicon.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ scw apple-silicon server create [arg=value ...]
| type | | Create a server of the given type |
| os-id | | Create a server with the given os_id |
| enable-vpc | | Activate the Private Network feature for this server |
| commitment-type | One of: `duration_24h`, `renewed_monthly`, `none` | Activate commitment for this server |
| zone | Default: `fr-par-1`<br />One of: `fr-par-3` | Zone to target. If none is passed will use default zone from the config |


Expand Down Expand Up @@ -344,6 +345,7 @@ scw apple-silicon server update <server-id ...> [arg=value ...]
| name | | Updated name for your server |
| schedule-deletion | | Specify whether the server should be flagged for automatic deletion |
| enable-vpc | | Activate or deactivate Private Network support for this server |
| commitment-type.commitment-type | One of: `duration_24h`, `renewed_monthly`, `none` | |
| zone | Default: `fr-par-1`<br />One of: `fr-par-3` | Zone to target. If none is passed will use default zone from the config |


Expand Down
2 changes: 1 addition & 1 deletion internal/alias/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/internal/alias"
"github.com/stretchr/testify/assert"
)

func TestConfig_ResolveAliases(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions internal/args/args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/internal/args"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -150,7 +150,7 @@ type SamePrefixArgName struct {
func TestRawArgs_GetAll(t *testing.T) {
t.Run("Simple", func(t *testing.T) {
a := args.RawArgs{"ssh-keys.0=foo", "ssh-keys.1=bar"}
assert.Equal(t, a.GetAll("ssh-keys.{index}"), []string{"foo", "bar"})
assert.Equal(t, []string{"foo", "bar"}, a.GetAll("ssh-keys.{index}"))
})

t.Run("Insane", func(t *testing.T) {
Expand All @@ -160,7 +160,7 @@ func TestRawArgs_GetAll(t *testing.T) {
"countries.FR.cities.nice.street.promenade=anglais",
"countries.RU.cities.moscow.street.kremelin=rouge",
}
assert.Equal(t, a.GetAll("countries.{key}.cities.{key}.street.{key}"), []string{"pouet", "tati", "anglais", "rouge"})
assert.Equal(t, []string{"pouet", "tati", "anglais", "rouge"}, a.GetAll("countries.{key}.cities.{key}.street.{key}"))
})
}

Expand Down
4 changes: 2 additions & 2 deletions internal/e2e/sdk_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package e2e_test
import (
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/test/v1"
sdktest "github.com/scaleway/scaleway-sdk-go/api/test/v1"
"github.com/stretchr/testify/assert"
)

// TestSdkStandardErrors tests standard errors
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestSdkStandardErrors(t *testing.T) {
_, err := api.RunHuman(&sdktest.RunHumanRequest{
HumanID: "0194fdc2-fa2f-fcc0-41d3-ff12045b73c8",
})
assert.Equal(t, nil, err)
assert.NoError(t, err)

return nil
},
Expand Down
11 changes: 6 additions & 5 deletions internal/editor/editor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package editor_test
import (
"testing"

"github.com/alecthomas/assert"
"github.com/scaleway/scaleway-cli/v2/internal/editor"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func Test_updateResourceEditor(t *testing.T) {
Expand All @@ -26,7 +27,7 @@ func Test_updateResourceEditor(t *testing.T) {
}

_, err := editor.UpdateResourceEditor(resource, updateRequest, &editor.Config{})
assert.Nil(t, err)
assert.NoError(t, err)
}

func Test_updateResourceEditor_pointers(t *testing.T) {
Expand All @@ -50,7 +51,7 @@ func Test_updateResourceEditor_pointers(t *testing.T) {
}

editedUpdateRequestI, err := editor.UpdateResourceEditor(resource, updateRequest, &editor.Config{})
assert.Nil(t, err)
require.NoError(t, err)
editedUpdateRequest := editedUpdateRequestI.(*UpdateRequest)

assert.NotNil(t, editedUpdateRequest.Name)
Expand Down Expand Up @@ -85,8 +86,8 @@ id: uuid
env: {}
`,
})
assert.Nil(t, err)
require.NoError(t, err)
editedUpdateRequest := editedUpdateRequestI.(*UpdateRequest)
assert.NotNil(t, editedUpdateRequest.Env)
assert.True(t, len(*editedUpdateRequest.Env) == 0)
assert.Empty(t, *editedUpdateRequest.Env)
}
Loading

0 comments on commit 1a61e7a

Please sign in to comment.