From 1cf663e2c10f42dad9ae321857ba8a584e9c8ca4 Mon Sep 17 00:00:00 2001 From: tuhui1 Date: Fri, 27 Sep 2024 11:15:01 +0800 Subject: [PATCH] fix: unnecessary fmt.Sprintf in assertions --- pkg/security/apparmor/validate_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/security/apparmor/validate_test.go b/pkg/security/apparmor/validate_test.go index 58cf7d93fd8..9d9a5789cb1 100644 --- a/pkg/security/apparmor/validate_test.go +++ b/pkg/security/apparmor/validate_test.go @@ -18,7 +18,6 @@ package apparmor import ( "errors" - "fmt" "testing" v1 "k8s.io/api/core/v1" @@ -71,9 +70,9 @@ func TestValidateValidHost(t *testing.T) { for _, test := range tests { err := v.Validate(getPodWithProfile(test.profile)) if test.expectValid { - assert.NoError(t, err, "Pod with profile %q should be valid", test.profile) + assert.NoErrorf(t, err, "Pod with profile %q should be valid", test.profile) } else { - assert.Error(t, err, fmt.Sprintf("Pod with profile %q should trigger a validation error", test.profile)) + assert.Errorf(t, err, "Pod with profile %q should trigger a validation error", test.profile) } }