You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by cc...@apache.org on 2024/09/06 15:14:25 UTC
(yunikorn-k8shim) branch master updated: [YUNIKORN-2714] Add e2e test to verify queue name with special characters (#906)
This is an automated email from the ASF dual-hosted git repository.
ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
The following commit(s) were added to refs/heads/master by this push:
new 58c0c361 [YUNIKORN-2714] Add e2e test to verify queue name with special characters (#906)
58c0c361 is described below
commit 58c0c361eb44b7e695f5024aa2c0774f4584dabc
Author: rrajesh <rr...@cloudera.com>
AuthorDate: Fri Sep 6 10:14:07 2024 -0500
[YUNIKORN-2714] Add e2e test to verify queue name with special characters (#906)
Closes: #906
Signed-off-by: Craig Condit <cc...@apache.org>
---
test/e2e/user_group_limit/user_group_limit_test.go | 75 ++++++++++++++++++++--
1 file changed, 71 insertions(+), 4 deletions(-)
diff --git a/test/e2e/user_group_limit/user_group_limit_test.go b/test/e2e/user_group_limit/user_group_limit_test.go
index e4d74413..eac84c2b 100644
--- a/test/e2e/user_group_limit/user_group_limit_test.go
+++ b/test/e2e/user_group_limit/user_group_limit_test.go
@@ -25,10 +25,6 @@ import (
"runtime"
"time"
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
-
"github.com/apache/yunikorn-core/pkg/common/configs"
"github.com/apache/yunikorn-core/pkg/common/resources"
"github.com/apache/yunikorn-core/pkg/webservice/dao"
@@ -36,11 +32,18 @@ import (
amconf "github.com/apache/yunikorn-k8shim/pkg/admission/conf"
"github.com/apache/yunikorn-k8shim/pkg/common/constants"
tests "github.com/apache/yunikorn-k8shim/test/e2e"
+ "github.com/apache/yunikorn-k8shim/test/e2e/framework/configmanager"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
"github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common"
"github.com/apache/yunikorn-scheduler-interface/lib/go/si"
+
+ "github.com/onsi/ginkgo/v2"
+ "github.com/onsi/gomega"
+
+ v1 "k8s.io/api/core/v1"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type TestType int
@@ -641,6 +644,70 @@ var _ = ginkgo.Describe("UserGroupLimit", func() {
checkUsage(groupTestType, url.QueryEscape(validGroup), sandboxQueue1, []*v1.Pod{usergroup1Sandbox1Pod1})
})
+ ginkgo.It("Verify_Queue_Name_With_Special_Characters", func() {
+ ginkgo.By("Create a queue with a name that includes all allowed special characters")
+ queueName := "root_test22-a_b_#_c_#_d_/_e@dom:ain"
+ yunikorn.UpdateCustomConfigMapWrapper(oldConfigMap, "", func(sc *configs.SchedulerConfig) error {
+ // remove placement rules so we can control queue
+ sc.Partitions[0].PlacementRules = nil
+ var err error
+ if err = common.AddQueue(sc, "default", "root", configs.QueueConfig{
+ Name: queueName,
+ Resources: configs.Resources{Guaranteed: map[string]string{"memory": fmt.Sprintf("%dM", 200)}},
+ Properties: map[string]string{"preemption.delay": "1s"},
+ }); err != nil {
+ return err
+ }
+ return nil
+ })
+ ginkgo.By("Fetch the queue information using the REST API")
+ queueInfo, err := restClient.GetQueue("default", "root."+url.QueryEscape(queueName), false)
+ gomega.Ω(err).NotTo(gomega.HaveOccurred())
+ gomega.Ω(queueInfo.QueueName).To(gomega.Equal("root." + queueName))
+ })
+
+ ginkgo.It("Verify_Queue_Name_With_Disallowed_Special_Characters", func() {
+ ginkgo.By("Attempt to create a queue with a name that includes disallowed special characters")
+ invalidConfig := `
+ partitions:
+ - name: default
+ placementrules:
+ - name: tag
+ value: namespace
+ create: true
+ queues:
+ - name: root_test22-a_b_#_c_#_d__e@dom:ain$
+ submitacl: '*'
+`
+ queueName := "root_test22-a_b_#_c_#_d__e@dom:ain$"
+ invalidConfigData := map[string]string{"queues.yaml": invalidConfig}
+ invalidConfigMap := &v1.ConfigMap{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: constants.ConfigMapName,
+ Namespace: configmanager.YuniKornTestConfig.YkNamespace,
+ },
+ Data: invalidConfigData,
+ }
+ _, invalidConfigErr := kClient.UpdateConfigMap(invalidConfigMap, configmanager.YuniKornTestConfig.YkNamespace)
+ gomega.Ω(invalidConfigErr).Should(gomega.HaveOccurred())
+ ginkgo.By("Verify that the queue was not created")
+ _, err := restClient.GetQueue("default", "root."+url.QueryEscape(queueName), false)
+ gomega.Ω(err).To(gomega.HaveOccurred()) // Expect an error
+ queueName2 := "root_test22"
+ yunikorn.UpdateCustomConfigMapWrapper(oldConfigMap, "", func(sc *configs.SchedulerConfig) error {
+ // remove placement rules so we can control queue
+ sc.Partitions[0].PlacementRules = nil
+ var err error
+ if err = common.AddQueue(sc, "default", "root", configs.QueueConfig{
+ Name: queueName2,
+ Resources: configs.Resources{Guaranteed: map[string]string{"memory": fmt.Sprintf("%dM", 200)}},
+ Properties: map[string]string{"preemption.delay": "1s"},
+ }); err != nil {
+ return err
+ }
+ return nil
+ })
+ })
ginkgo.AfterEach(func() {
tests.DumpClusterInfoIfSpecFailed(suiteName, []string{ns.Name})
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org