Revert "remove unwanted values returned from dry-run"
This reverts commit 60c1d58d02
.
This commit is contained in:
@@ -18,7 +18,6 @@ package dryrun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@@ -48,11 +47,7 @@ var kindAllowList = sets.NewString()
|
||||
const testNamespace = "dryrunnamespace"
|
||||
|
||||
func DryRunCreateWithGenerateNameTest(t *testing.T, rsc dynamic.ResourceInterface, obj *unstructured.Unstructured, gvResource schema.GroupVersionResource) {
|
||||
// special resources with dots in the name cannot use generateName
|
||||
if strings.Contains(obj.GetName(), ".") {
|
||||
return
|
||||
}
|
||||
// Create a new object with generateName to ensure we don't taint the original object
|
||||
// Create a new object with generateName
|
||||
gnObj := obj.DeepCopy()
|
||||
gnObj.SetGenerateName(obj.GetName() + "-")
|
||||
gnObj.SetName("")
|
||||
@@ -79,11 +74,8 @@ func DryRunCreateTest(t *testing.T, rsc dynamic.ResourceInterface, obj *unstruct
|
||||
t.Fatalf("created object's name should be an empty string if using GenerateName: %v", createdObj)
|
||||
}
|
||||
|
||||
// we won't have a generated name here, so we won't check for this case
|
||||
if obj.GetGenerateName() == "" {
|
||||
if _, err := rsc.Get(context.TODO(), obj.GetName(), metav1.GetOptions{}); !apierrors.IsNotFound(err) {
|
||||
t.Fatalf("object shouldn't exist: %v, %v", obj, err)
|
||||
}
|
||||
if _, err := rsc.Get(context.TODO(), obj.GetName(), metav1.GetOptions{}); !apierrors.IsNotFound(err) {
|
||||
t.Fatalf("object shouldn't exist: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user