// TestNameReferenceNamespace creates serviceAccount and clusterRoleBinding
// object with the same original names (uniquename) in different namespaces
// and with different current Id.
TestNameReferenceNamespace creates serviceAccount and clusterRoleBinding
object with the same original names (uniquename) in different namespaces
and with different current Id.
// TestNameReferenceNamespace creates serviceAccount and clusterRoleBinding // object with the same original names ( uniquename ) in different namespaces // and with different current Id .
func TestNameReferenceNamespace(t *testing.T) {
	m := resmaptest_test.NewRmBuilderDefault(t).
		AddWithName(orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "ConfigMap",
			"metadata": map[string]interface{}{
				"name": modifiedname,
			}}).
		AddWithNsAndName(ns1, orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "ConfigMap",
			"metadata": map[string]interface{}{
				"name":      prefixedname,
				"namespace": ns1,
			}}).
		AddWithNsAndName(ns2, orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "ConfigMap",
			"metadata": map[string]interface{}{
				"name":      suffixedname,
				"namespace": ns2,
			}}).
		AddWithNsAndName(defaultNs, orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "Secret",
			"metadata": map[string]interface{}{
				"name":      modifiedname,
				"namespace": defaultNs,
			}}).
		AddWithNsAndName(ns1, orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "Secret",
			"metadata": map[string]interface{}{
				"name":      prefixedname,
				"namespace": ns1,
			}}).
		AddWithNsAndName(ns2, orgname, map[string]interface{}{
			"apiVersion": "v1",
			"kind":       "Secret",
			"metadata": map[string]interface{}{
				"name":      suffixedname,
				"namespace": ns2,
			}}).
		AddWithNsAndName(defaultNs, orgname, deploymentMap(defaultNs, modifiedname, modifiedname, modifiedname)).
		AddWithNsAndName(ns1, orgname, deploymentMap(ns1, prefixedname, orgname, orgname)).
		AddWithNsAndName(ns2, orgname, deploymentMap(ns2, suffixedname, orgname, orgname)).ResMap()
	expected := resmaptest_test.NewSeededRmBuilderDefault(t, m.ShallowCopy()).
		ReplaceResource(deploymentMap(defaultNs, modifiedname, modifiedname, modifiedname)).
		ReplaceResource(deploymentMap(ns1, prefixedname, prefixedname, prefixedname)).
		ReplaceResource(deploymentMap(ns2, suffixedname, suffixedname, suffixedname)).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 TestNameReferenceNamespace ( t * testing . T ) { m := resmaptest_test . NewRmBuilderDefault ( t ) . AddWithName ( orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : modifiedname , } } ) . AddWithNsAndName ( ns1 , orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : prefixedname , " " : ns1 , } } ) . AddWithNsAndName ( ns2 , orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : suffixedname , " " : ns2 , } } ) . AddWithNsAndName ( defaultNs , orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : modifiedname , " " : defaultNs , } } ) . AddWithNsAndName ( ns1 , orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : prefixedname , " " : ns1 , } } ) . AddWithNsAndName ( ns2 , orgname , map [ string ] interface { } { " " : " " , " " : " " , " " : map [ string ] interface { } { " " : suffixedname , " " : ns2 , } } ) . AddWithNsAndName ( defaultNs , orgname , deploymentMap ( defaultNs , modifiedname , modifiedname , modifiedname ) ) . AddWithNsAndName ( ns1 , orgname , deploymentMap ( ns1 , prefixedname , orgname , orgname ) ) . AddWithNsAndName ( ns2 , orgname , deploymentMap ( ns2 , suffixedname , orgname , orgname ) ) . ResMap ( ) expected := resmaptest_test . NewSeededRmBuilderDefault ( t , m . ShallowCopy ( ) ) . ReplaceResource ( deploymentMap ( defaultNs , modifiedname , modifiedname , modifiedname ) ) . ReplaceResource ( deploymentMap ( ns1 , prefixedname , prefixedname , prefixedname ) ) . ReplaceResource ( deploymentMap ( ns2 , suffixedname , suffixedname , suffixedname ) ) . 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 serviceAccount and clusterRoleBinding
object with the same original names (uniquename) in different namespaces
and with different current Id.
TestNameReferenceNamespace creates serviceAccount and clusterRoleBinding object with the same original names ( uniquename ) in different namespaces and with different current Id .
// Add ConfigMap with the same org name in noNs, "ns1" and "ns2" namespaces // Add Secret with the same org name in noNs, "ns1" and "ns2" namespaces // Add Deployment with the same org name in noNs, "ns1" and "ns2" namespaces