// TestNameReferenceNamespace creates configmap, secret, deployment
// It validates the change done is IsSameFuzzyNamespace which
// uses the IsNsEquals method instead of the simple == operator.
TestNameReferenceNamespace creates configmap, secret, deployment
It validates the change done is IsSameFuzzyNamespace which
uses the IsNsEquals method instead of the simple == operator.
// TestNameReferenceNamespace creates configmap secret deployment // It validates the change done is IsSameFuzzyNamespace which // uses the IsNsEquals method instead of the simple == operator .
func TestNameReferenceCandidateSelection(t *testing.T) {
	m := resmaptest_test.NewRmBuilderDefault(t).
		AddWithName("cm1", map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "ConfigMap",
			"metadata": map[string]interface{}{
				"name": "p1-cm1-hash",
			}}).
		AddWithNsAndName("default", "secret1", map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "Secret",
			"metadata": map[string]interface{}{
				"name":      "p1-secret1-hash",
				"namespace": "default",
			}}).
		AddWithName("deploy1", deploymentMap("", "p1-deploy1", "cm1", "secret1")).
		ResMap()
	expected := resmaptest_test.NewSeededRmBuilderDefault(t, m.ShallowCopy()).
		ReplaceResource(deploymentMap("", "p1-deploy1", "p1-cm1-hash", "p1-secret1-hash")).
		ResMap()
	nrt := newNameReferenceTransformer(builtinconfig.MakeDefaultConfig().NameReference)
	err := nrt.Transform(m)
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}
	m.RemoveBuildAnnotations()
	if err = expected.ErrorIfNotEqualLists(m); err != nil {
		t.Fatalf(notEqualErrFmt, err)
	}
}
func TestNameReferenceCandidateSelection ( t * testing . T ) { m := resmaptest_test . NewRmBuilderDefault ( t ) . AddWithName ( " " , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : " " , } } ) . AddWithNsAndName ( " " , " " , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : " " , " " : " " , } } ) . AddWithName ( " " , deploymentMap ( " " , " " , " " , " " ) ) . ResMap ( ) expected := resmaptest_test . NewSeededRmBuilderDefault ( t , m . ShallowCopy ( ) ) . ReplaceResource ( deploymentMap ( " " , " " , " " , " " ) ) . ResMap ( ) nrt := newNameReferenceTransformer ( builtinconfig . MakeDefaultConfig ( ) . NameReference ) err := nrt . Transform ( m ) if err != nil { t . Fatalf ( " " , err ) } m . RemoveBuildAnnotations ( ) if err = expected . ErrorIfNotEqualLists ( m ) ; err != nil { t . Fatalf ( notEqualErrFmt , err ) } }
TestNameReferenceNamespace creates configmap, secret, deployment
It validates the change done is IsSameFuzzyNamespace which
uses the IsNsEquals method instead of the simple == operator.
TestNameReferenceNamespace creates configmap secret deployment It validates the change done is IsSameFuzzyNamespace which uses the IsNsEquals method instead of the simple == operator .