Skip to content

Commit

Permalink
[YUNIKORN-2852] Add e2e tests for group names in placement rule filter (
Browse files Browse the repository at this point in the history
#908)

Closes: #908

Signed-off-by: Craig Condit <[email protected]>
  • Loading branch information
rrajesh-cloudera authored and craigcondit committed Sep 6, 2024
1 parent 8ab6ecf commit c8987b8
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/e2e/configmap/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -209,6 +210,64 @@ partitions:
gomega.Ω(invalidConfigErr).Should(gomega.HaveOccurred())
})

ginkgo.It("Configure the scheduler with a valid group name in placement rule filter", func() {
validConfig := `
partitions:
- name: default
placementrules:
- name: fixed
value: root_Test-a_b_#_c_#_d_/_e@dom:ain
create: true
filter:
type: allow
groups:
- group1
- group_Test-a_b_#_c_#_d_/_e@dom:ain.com
queues:
- name: root
submitacl: '*'
`
data := map[string]string{"queues.yaml": validConfig}
validConfigMap := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: constants.ConfigMapName,
Namespace: configmanager.YuniKornTestConfig.YkNamespace,
},
Data: data,
}
cm, err := kClient.UpdateConfigMap(validConfigMap, configmanager.YuniKornTestConfig.YkNamespace)
gomega.Ω(err).ShouldNot(gomega.HaveOccurred())
gomega.Ω(cm).ShouldNot(gomega.BeNil())
})

ginkgo.It("Configure the scheduler with an invalid group name in placement rule filter", func() {
invalidConfig := `
partitions:
- name: default
placementrules:
- name: fixed
value: root_Test-a_b_#_c_#_d_/_e@dom:ain
create: true
filter:
type: allow
groups:
- group_inva!lid
queues:
- name: root
submitacl: '*'
`
data := map[string]string{"queues.yaml": invalidConfig}
invalidConfigMap := &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: constants.ConfigMapName,
Namespace: configmanager.YuniKornTestConfig.YkNamespace,
},
Data: data,
}
_, err := kClient.UpdateConfigMap(invalidConfigMap, configmanager.YuniKornTestConfig.YkNamespace)
gomega.Ω(err).Should(gomega.HaveOccurred())
})

AfterEach(func() {
tests.DumpClusterInfoIfSpecFailed(suiteName, []string{"default"})
yunikorn.RestoreConfigMapWrapper(oldConfigMap)
Expand Down

0 comments on commit c8987b8

Please sign in to comment.