INNER CODE UNIT · Go

assertMemberClusterRolesDoNotExist

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

func assertMemberClusterRolesDoNotExist(t *testing.T, clientMap map[string]kubernetes.Interface, flags flags) {
	assertClusterRoles(t, clientMap, flags, false, centralCluster)
}

// assertClusterRoles should be used to assert the existence of member cluster cluster roles. The boolean
// shouldExist should be true for roles existing, and false for cluster roles not existing.
func assertClusterRoles(t *testing.T, clientMap map[string]kubernetes.Interface, flags flags, shouldExist bool, clusterType clusterType) {
	var expectedClusterRole rbacv1.ClusterRole
	if clusterType == centralCluster {
		expectedClusterRole = buildCentralEntityClusterRole()
	} else {
		expectedClusterRole = buildMemberEntityClusterRole()
	}

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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…