INNER CODE UNIT · Go

assertMemberRolesDoNotExist

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

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 {
			assert.NoError(t, err)
			assert.NotNil(t, role)
			assert.Equal(t, expectedRole, *role)
		} else {
			assert.Error(t, err)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…