diff --git a/pkg/apiserver/registry/datapackaging/package_crd_rest_test.go b/pkg/apiserver/registry/datapackaging/package_crd_rest_test.go index a1bdb167b..386421317 100644 --- a/pkg/apiserver/registry/datapackaging/package_crd_rest_test.go +++ b/pkg/apiserver/registry/datapackaging/package_crd_rest_test.go @@ -146,6 +146,7 @@ func TestPackageVersionGetPresentInOnlyNS(t *testing.T) { func TestPackageVersionGetNotFound(t *testing.T) { namespacedPackageVersion := excludedNonGlobalIntPackageVersion() name := namespacedPackageName + expectedError := "package.data.packaging.carvel.dev \"" + name + "\" not found" internalClient := fake.NewSimpleClientset(namespacedPackageVersion) fakeCoreClient := k8sfake.NewSimpleClientset(namespace()) @@ -157,8 +158,8 @@ func TestPackageVersionGetNotFound(t *testing.T) { t.Fatalf("Expected get operation to fail, but it didn't") } - if !errors.IsNotFound(err) { - t.Fatalf("Expected a not found error, got: %v", err) + if !errors.IsNotFound(err) || err.Error() != expectedError { + t.Fatalf("Expected error : %s, got: %v", expectedError, err) } }