@@ -1757,16 +1757,16 @@ const sharedTagKeyParentErr = "Parent %q is not valid. Should be in format: 'org
17571757
17581758func BootstrapSharedTestProjectTagKey (t * testing.T , testId string , obj map [string ]interface {}) string {
17591759 pid := envvar .GetTestProjectFromEnv ()
1760- return bootstrapSharedTestTagKey (t , testId , "projects/" + pid , obj )
1760+ return BootstrapSharedTestTagKeyDetails (t , testId , "projects/" + pid , obj )[ "shared_tag_key" ]
17611761}
17621762
17631763func BootstrapSharedTestOrganizationTagKey (t * testing.T , testId string , obj map [string ]interface {}) string {
17641764 org := envvar .GetTestOrgFromEnv (t )
1765- return bootstrapSharedTestTagKey (t , testId , "organizations/" + org , obj )
1765+ return BootstrapSharedTestTagKeyDetails (t , testId , "organizations/" + org , obj )[ "shared_tag_key" ]
17661766}
17671767
17681768// parent should be in format: {"organization" OR "projects"}/{id}
1769- func bootstrapSharedTestTagKey (t * testing.T , testId , parent string , obj map [string ]interface {}) string {
1769+ func BootstrapSharedTestTagKeyDetails (t * testing.T , testId string , parent string , obj map [string ]interface {}) map [ string ] string {
17701770 sharedTagKey := fmt .Sprintf ("%s-%s" , sharedTagKeyPrefix , testId )
17711771
17721772 parentSplit := strings .Split (parent , "/" )
@@ -1780,7 +1780,7 @@ func bootstrapSharedTestTagKey(t *testing.T, testId, parent string, obj map[stri
17801780
17811781 config := BootstrapConfig (t )
17821782 if config == nil {
1783- return ""
1783+ return make ( map [ string ] string )
17841784 }
17851785
17861786 log .Printf ("[DEBUG] Getting shared test tag key %q" , sharedTagKey )
@@ -1829,7 +1829,7 @@ func bootstrapSharedTestTagKey(t *testing.T, testId, parent string, obj map[stri
18291829 }
18301830 }
18311831
1832- _ , err = transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
1832+ getTagKeyResponse , err : = transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
18331833 Config : config ,
18341834 Method : "GET" ,
18351835 Project : config .Project ,
@@ -1842,29 +1842,32 @@ func bootstrapSharedTestTagKey(t *testing.T, testId, parent string, obj map[stri
18421842 t .Fatalf ("Error getting shared tag key %q: %s" , sharedTagKey , err )
18431843 }
18441844
1845- return sharedTagKey
1845+ return map [string ]string {
1846+ "name" : getTagKeyResponse ["name" ].(string ),
1847+ "shared_tag_key" : sharedTagKey ,
1848+ }
18461849}
18471850
18481851const sharedTagValuePrefix = "tf-bootstrap-tagvalue"
18491852
18501853func BootstrapSharedTestProjectTagValue (t * testing.T , testId string , tagKey string ) string {
18511854 pid := envvar .GetTestProjectFromEnv ()
1852- return BootstrapSharedTestTagValue (t , testId , tagKey , pid )
1855+ return BootstrapSharedTestTagValueDetails (t , testId , tagKey , pid )[ "shared_tag_value" ]
18531856}
18541857
18551858func BootstrapSharedTestOrganizationTagValue (t * testing.T , testId string , tagKey string ) string {
18561859 org := envvar .GetTestOrgFromEnv (t )
1857- return BootstrapSharedTestTagValue (t , testId , tagKey , org )
1860+ return BootstrapSharedTestTagValueDetails (t , testId , tagKey , org )[ "shared_tag_value" ]
18581861}
18591862
1860- func BootstrapSharedTestTagValue (t * testing.T , testId string , tagKey , parentId string ) string {
1863+ func BootstrapSharedTestTagValueDetails (t * testing.T , testId string , tagKey , parentId string ) map [ string ] string {
18611864 sharedTagValue := fmt .Sprintf ("%s-%s" , sharedTagValuePrefix , testId )
18621865 tagKeyName := fmt .Sprintf ("%s/%s" , parentId , tagKey )
18631866 tagValueName := fmt .Sprintf ("%s/%s" , tagKeyName , sharedTagValue )
18641867
18651868 config := BootstrapConfig (t )
18661869 if config == nil {
1867- return ""
1870+ return make ( map [ string ] string )
18681871 }
18691872
18701873 log .Printf ("[DEBUG] Getting shared test tag value %q" , sharedTagValue )
@@ -1923,8 +1926,7 @@ func BootstrapSharedTestTagValue(t *testing.T, testId string, tagKey, parentId s
19231926 t .Fatalf ("Error waiting to create TagValue: %s" , err )
19241927 }
19251928 }
1926-
1927- _ , err = transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
1929+ getTagValueResponse , err := transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
19281930 Config : config ,
19291931 Method : "GET" ,
19301932 Project : config .Project ,
@@ -1937,7 +1939,10 @@ func BootstrapSharedTestTagValue(t *testing.T, testId string, tagKey, parentId s
19371939 t .Fatalf ("Error getting shared tag value %q: %s" , sharedTagValue , err )
19381940 }
19391941
1940- return sharedTagValue
1942+ return map [string ]string {
1943+ "name" : getTagValueResponse ["name" ].(string ),
1944+ "shared_tag_value" : sharedTagValue ,
1945+ }
19411946}
19421947
19431948type BootstrapClient struct {
0 commit comments