Skip to content
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
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ linters:
- staticcheck
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes [fast: false, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
Expand Down
6 changes: 4 additions & 2 deletions internal/args/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/scaleway/scaleway-cli/v2/internal/args"

"github.com/scaleway/scaleway-sdk-go/scw"
Expand All @@ -25,7 +27,7 @@ func TestMarshal(t *testing.T) {
args, err := args.MarshalStruct(testCase.data)

if testCase.error == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, testCase.expected, args)
} else {
assert.Equal(t, testCase.error, err.Error())
Expand Down Expand Up @@ -238,7 +240,7 @@ func TestMarshalValue(t *testing.T) {
value, err := args.MarshalValue(testCase.data)

if testCase.error == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, testCase.expected, value)
} else {
assert.Equal(t, testCase.error, err.Error())
Expand Down
4 changes: 3 additions & 1 deletion internal/args/unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/scaleway/scaleway-cli/v2/internal/args"

"github.com/scaleway/scaleway-sdk-go/scw"
Expand Down Expand Up @@ -35,7 +37,7 @@ func TestUnmarshalStruct(t *testing.T) {
err := args.UnmarshalStruct(testCase.args, testCase.data)

if testCase.error == "" {
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, testCase.expected, testCase.data)
} else {
assert.Equal(t, testCase.error, err.Error())
Expand Down
4 changes: 2 additions & 2 deletions internal/core/cobra_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func Test_MultiPositionalArg(t *testing.T) {
core.TestCheckGolden(),
func(t *testing.T, ctx *core.CheckFuncCtx) {
res := ctx.Result.(*testAcceptMultiPositionalArgsType)
assert.Equal(t, 1, len(res.NameIDs))
assert.Len(t, res.NameIDs, 1)
assert.Equal(t, "pos1", res.NameIDs[0])
assert.Equal(t, "tag1", res.Tag)
},
Expand All @@ -297,7 +297,7 @@ func Test_MultiPositionalArg(t *testing.T) {
core.TestCheckGolden(),
func(t *testing.T, ctx *core.CheckFuncCtx) {
res := ctx.Result.(*testAcceptMultiPositionalArgsType)
assert.Equal(t, 3, len(res.NameIDs))
assert.Len(t, res.NameIDs, 3)
assert.Equal(t, "pos1", res.NameIDs[0])
assert.Equal(t, "pos2", res.NameIDs[1])
assert.Equal(t, "pos3", res.NameIDs[2])
Expand Down
6 changes: 4 additions & 2 deletions internal/core/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package core_test
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/scaleway/scaleway-cli/v2/internal/core"

"github.com/stretchr/testify/assert"
Expand All @@ -18,9 +20,9 @@ func TestResult(t *testing.T) {
}

humanOutput, err := result.MarshalHuman()
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, "", humanOutput)
jsonOutput, err := result.MarshalJSON()
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, []byte("{}"), jsonOutput)
}
2 changes: 1 addition & 1 deletion internal/core/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ func TestCheckGoldenAndReplacePatterns(replacements ...GoldenReplacement) TestCh
expected, err := os.ReadFile(goldenPath)
require.NoError(t, err, "expected to find golden file %s", goldenPath)
assert.Equal(t, string(expected), actual)
assert.Nil(t, actualReplaceErr, "failed to match test output with regexes")
assert.NoError(t, actualReplaceErr, "failed to match test output with regexes")
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/namespaces/instance/v1/instance_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func Test_ServerUpdate(t *testing.T) {
Cmd: `scw instance server update {{ .Server.ID }} placement-group-id={{ .PlacementGroup2.ID }}`,
Check: core.TestCheckCombine(
func(t *testing.T, ctx *core.CheckFuncCtx) {
assert.NoError(t, ctx.Err)
require.NoError(t, ctx.Err)
assert.Equal(t,
ctx.Meta["PlacementGroup2"].(*instanceSDK.PlacementGroup).ID,
ctx.Result.(*instanceSDK.UpdateServerResponse).Server.PlacementGroup.ID,
Expand Down