Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2714] Add e2e test to verify queue name with special characters #906

Closed
34 changes: 34 additions & 0 deletions test/e2e/user_group_limit/user_group_limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,40 @@ 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 := "queue-#_@/:"

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")
allQueues, err := restClient.GetQueues("default")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using this API and traverse over queues, it is better to directly hit Queue specific REST API https://yunikorn.apache.org/docs/api/scheduler#partition-queue because it covers the url encoding part as well. Please include the -ve test cases too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @manirajv06 , Updated the code with URL Encoded and Negative case as well. Please take a look.

gomega.Ω(err).NotTo(gomega.HaveOccurred())
ginkgo.By("Verify that the queue information is returned correctly")
// loop through allQueues.children to find the queue with the name we created
for _, queue := range allQueues.Children {
if queue.QueueName == "root."+queueName {
gomega.Ω(queue.QueueName).To(gomega.Equal("root." + queueName))
} else {
gomega.Ω(queue.QueueName).NotTo(gomega.Equal("root." + queueName))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we started using direct API below, can we clean up the above code from line no. 664 to 674?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will remove this part of code.

Qerr := restClient.WaitforQueueToAppear("default", "root."+queueName, 20)
gomega.Ω(Qerr).NotTo(gomega.HaveOccurred())
})

ginkgo.AfterEach(func() {
tests.DumpClusterInfoIfSpecFailed(suiteName, []string{ns.Name})

Expand Down
Loading