Skip to content

Commit

Permalink
chore: enable testifylint linter
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Nov 30, 2024
1 parent 31bed85 commit e6274e3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/configresolver/config_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestIgnorePaths(t *testing.T) {
} else {
for _, path := range paths {
assert.NoError(t, err)
assert.Equal(t, path, e.Expected)
assert.Equal(t, e.Expected, path)
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/templates/danglinghpa/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"golang.stackrox.io/kube-linter/pkg/diagnostic"
"golang.stackrox.io/kube-linter/pkg/lintcontext/mocks"
Expand Down Expand Up @@ -84,7 +83,7 @@ func (s *DanglingHpaSuite) addHpaWithTarget(name string, target objectReference,
}
})
default:
require.FailNow(s.T(), fmt.Sprintf("Unknown autoscaling version %s", version))
s.Require().FailNow(fmt.Sprintf("Unknown autoscaling version %s", version))
}
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/templates/hpareplicas/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/require"

"github.com/stretchr/testify/suite"
"golang.stackrox.io/kube-linter/pkg/diagnostic"
"golang.stackrox.io/kube-linter/pkg/lintcontext/mocks"
Expand Down Expand Up @@ -54,7 +52,7 @@ func (s *HPAReplicaTestSuite) addHPAWithReplicas(name string, replicas int32, ve
hpa.Spec.MinReplicas = &replicas
})
default:
require.FailNow(s.T(), fmt.Sprintf("Unknown autoscaling version %s", version))
s.Require().FailNow(fmt.Sprintf("Unknown autoscaling version %s", version))
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/templates/templates_testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type TestCase struct {

// Init initializes the test suite with a template
func (s *TemplateTestSuite) Init(templateKey string) {
s.T().Helper()
t, ok := Get(templateKey)
s.True(ok, "template with key %q not found", templateKey)
s.Template = t
Expand Down Expand Up @@ -53,6 +54,7 @@ func (s *TemplateTestSuite) Validate(
}

func (s *TemplateTestSuite) compareDiagnostics(expected, actual []diagnostic.Diagnostic) {
s.T().Helper()
expectedMessages, actualMessages := make([]string, 0, len(expected)), make([]string, 0, len(actual))
for _, diag := range expected {
expectedMessages = append(expectedMessages, diag.Message)
Expand Down
2 changes: 1 addition & 1 deletion pkg/templates/util/value_in_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestValueInRange(t *testing.T) {
} {
c := testCase
t.Run(fmt.Sprintf("%+v", c), func(t *testing.T) {
assert.Equal(t, ValueInRange(c.value, c.lowerBound, c.upperBound), c.expectedMatch)
assert.Equal(t, c.expectedMatch, ValueInRange(c.value, c.lowerBound, c.upperBound))
})
}
}

0 comments on commit e6274e3

Please sign in to comment.