INNER CODE UNIT · Go

assertMemberRolesExist

mongodb/mongodb-enterprise-kubernetes · tools/multicluster/main_test.go:523

func assertMemberRolesExist(t *testing.T, clientMap map[string]kubernetes.Interface, flags flags) {
	assertMemberRolesAreCorrect(t, clientMap, flags, true)
}

// assertMemberRolesDoNotExist should be used when member cluster roles should not exist.
func assertMemberRolesDoNotExist(t *testing.T, clientMap map[string]kubernetes.Interface, flags flags) {
	assertMemberRolesAreCorrect(t, clientMap, flags, false)
}

// assertMemberRolesAreCorrect should be used to assert the existence of member cluster roles. The boolean
// shouldExist should be true for roles existing, and false for roles not existing.
func assertMemberRolesAreCorrect(t *testing.T, clientMap map[string]kubernetes.Interface, flags flags, shouldExist bool) {
	expectedRole := buildMemberEntityRole(flags.memberClusterNamespace)

	for _, clusterName := range flags.memberClusters {
		client := clientMap[clusterName]
		role, err := client.RbacV1().Roles(flags.memberClusterNamespace).Get(context.TODO(), expectedRole.Name, metav1.GetOptions{})
		if shouldExist {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…