Skip to content

Commit 218d990

Browse files
melinathniharika-98
authored andcommitted
Removed BootstrapPSARole helpers (GoogleCloudPlatform#12871)
1 parent 118e539 commit 218d990

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

mmv1/third_party/terraform/acctest/bootstrap_iam_test_utils.go

+1-42
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type IamMember struct {
2424
func BootstrapIamMembers(t *testing.T, members []IamMember) {
2525
config := BootstrapConfig(t)
2626
if config == nil {
27-
t.Fatal("Could not bootstrap a config for BootstrapAllPSARoles.")
27+
t.Fatal("Could not bootstrap a config for BootstrapIamMembers.")
2828
}
2929
client := config.NewResourceManagerClient(config.UserAgent)
3030

@@ -72,44 +72,3 @@ func BootstrapIamMembers(t *testing.T, members []IamMember) {
7272
time.Sleep(3 * time.Minute)
7373
}
7474
}
75-
76-
// BootstrapAllPSARoles ensures that the given project's IAM
77-
// policy grants the given service agents the given roles.
78-
// prefix is usually "service-" and indicates the service agent should have the
79-
// given prefix before the project number.
80-
// This is important to bootstrap because using iam policy resources means that
81-
// deleting them removes permissions for concurrent tests.
82-
// Return whether the bindings changed.
83-
func BootstrapAllPSARoles(t *testing.T, prefix string, agentNames, roles []string) bool {
84-
var members []IamMember
85-
for _, agentName := range agentNames {
86-
member := fmt.Sprintf("serviceAccount:%s{project_number}@%s.iam.gserviceaccount.com", prefix, agentName)
87-
for _, role := range roles {
88-
members = append(members, IamMember{
89-
Member: member,
90-
Role: role,
91-
})
92-
}
93-
}
94-
BootstrapIamMembers(t, members)
95-
// Always return false because we now wait for IAM propagation.
96-
return false
97-
}
98-
99-
// BootstrapAllPSARole is a version of BootstrapAllPSARoles for granting a
100-
// single role to multiple service agents.
101-
func BootstrapAllPSARole(t *testing.T, prefix string, agentNames []string, role string) bool {
102-
return BootstrapAllPSARoles(t, prefix, agentNames, []string{role})
103-
}
104-
105-
// BootstrapPSARoles is a version of BootstrapAllPSARoles for granting roles to
106-
// a single service agent.
107-
func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) bool {
108-
return BootstrapAllPSARoles(t, prefix, []string{agentName}, roles)
109-
}
110-
111-
// BootstrapPSARole is a simplified version of BootstrapPSARoles for granting a
112-
// single role to a single service agent.
113-
func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool {
114-
return BootstrapPSARoles(t, prefix, agentName, []string{role})
115-
}

0 commit comments

Comments
 (0)