Skip to content

Commit

Permalink
chore: make linter happy
Browse files Browse the repository at this point in the history
Signed-off-by: Kumar Mallikarjuna <[email protected]>
  • Loading branch information
kumar-mallikarjuna committed Dec 4, 2024
1 parent f2422ae commit e6b22fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions pkg/apis/testharness/v1beta1/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
)

var (
apiVersionInvalidErr = errors.New("apiVersion not of the format (<group>/)<version>")
kindNotSpecifiedErr = errors.New("kind not specified")
nameNotSpecifiedErr = errors.New("name not specified")
refNotSpecifiedErr = errors.New("ref not specified")
errAPIVersionInvalid = errors.New("apiVersion not of the format (<group>/)<version>")
errKindNotSpecified = errors.New("kind not specified")
errNameNotSpecified = errors.New("name not specified")
errRefNotSpecified = errors.New("ref not specified")
)

func (t *TestResourceRef) BuildResourceReference() (namespacedName types.NamespacedName, referencedResource *unstructured.Unstructured) {
Expand All @@ -41,13 +41,13 @@ func (t *TestResourceRef) Validate() error {
apiVersionSplit := strings.Split(t.APIVersion, "/")
switch {
case t.APIVersion == "" || (len(apiVersionSplit) != 1 && len(apiVersionSplit) != 2):
return apiVersionInvalidErr
return errAPIVersionInvalid
case t.Kind == "":
return kindNotSpecifiedErr
return errKindNotSpecified
case t.Name == "":
return nameNotSpecifiedErr
return errNameNotSpecified
case t.Ref == "":
return refNotSpecifiedErr
return errRefNotSpecified
}

return nil
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/testharness/v1beta1/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestValidate(t *testing.T) {
Ref: "testPod",
},
errored: true,
expectedError: apiVersionInvalidErr,
expectedError: errAPIVersionInvalid,
},
{
name: "apiVersion is invalid",
Expand All @@ -38,7 +38,7 @@ func TestValidate(t *testing.T) {
Ref: "testPod",
},
errored: true,
expectedError: apiVersionInvalidErr,
expectedError: errAPIVersionInvalid,
},
{
name: "apiVersion is valid and group is vacuous",
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestValidate(t *testing.T) {
Ref: "testDeployment",
},
errored: true,
expectedError: kindNotSpecifiedErr,
expectedError: errKindNotSpecified,
},
{
name: "name is not specified",
Expand All @@ -82,7 +82,7 @@ func TestValidate(t *testing.T) {
Ref: "testDeployment",
},
errored: true,
expectedError: nameNotSpecifiedErr,
expectedError: errNameNotSpecified,
},
{
name: "ref is not specified",
Expand All @@ -93,7 +93,7 @@ func TestValidate(t *testing.T) {
Name: "test-deployment",
},
errored: true,
expectedError: refNotSpecifiedErr,
expectedError: errRefNotSpecified,
},
{
name: "all attributes are present and valid",
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/expression_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAssertExpressions(t *testing.T) {

fName := fmt.Sprintf(
"step_integration_test_data/assert_expressions/%s/00-assert.yaml",
strings.Replace(tc.name, " ", "_", -1),
strings.ReplaceAll(tc.name, " ", "_"),
)

// Load test that has an invalid expression
Expand Down

0 comments on commit e6b22fc

Please sign in to comment.