fix: unnecessary fmt.Sprintf in assertions

This commit is contained in:
tuhui1 2024-09-27 11:15:01 +08:00
parent 996e674ea7
commit 1cf663e2c1

View File

@ -18,7 +18,6 @@ package apparmor
import ( import (
"errors" "errors"
"fmt"
"testing" "testing"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
@ -71,9 +70,9 @@ func TestValidateValidHost(t *testing.T) {
for _, test := range tests { for _, test := range tests {
err := v.Validate(getPodWithProfile(test.profile)) err := v.Validate(getPodWithProfile(test.profile))
if test.expectValid { 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 { } 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)
} }
} }