Skip to content

Commit

Permalink
Add additional support to performance suite for SNO/CRC
Browse files Browse the repository at this point in the history
performance: skip if test pod are unschedulable
  • Loading branch information
sebrandon1 committed Jan 13, 2025
1 parent 4a5b60d commit 118a03b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 6 deletions.
14 changes: 14 additions & 0 deletions tests/globalhelper/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ func CreateAndWaitUntilPodIsReady(pod *corev1.Pod, timeout time.Duration) error
return fmt.Errorf("failed to create pod %q (ns %s): %w", pod.Name, pod.Namespace, err)
}

// Loop through pod conditions to check if pod is schedulable
// If it is not schedulable, we return an error
podSchedulable := false
for _, condition := range createdPod.Status.Conditions {

Check failure on line 81 in tests/globalhelper/pod.go

View workflow job for this annotation

GitHub Actions / lint

ranges should only be cuddled with assignments used in the iteration (wsl)
if condition.Type == corev1.PodScheduled && condition.Status == corev1.ConditionTrue {
podSchedulable = true
break

Check failure on line 84 in tests/globalhelper/pod.go

View workflow job for this annotation

GitHub Actions / lint

break with no blank line before (nlreturn)
}
}

if !podSchedulable {
return fmt.Errorf("pod %s is not schedulable", createdPod.Name)
}

Eventually(func() bool {
status, err := isPodReady(createdPod.Namespace, createdPod.Name)
if err != nil {
Expand Down
12 changes: 10 additions & 2 deletions tests/performance/tests/exclusive_cpu_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tests

import (
"runtime"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -56,6 +57,9 @@ var _ = Describe("performance-exclusive-cpu-pool", func() {
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start exclusive-cpu-pool test")
Expand All @@ -70,14 +74,16 @@ var _ = Describe("performance-exclusive-cpu-pool", func() {
})

It("One pod with one exclusive container, and one shared container", func() {

By("Define pod")
testPod := tshelper.DefineExclusivePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

tshelper.RedefinePodWithSharedContainer(testPod, 0)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start exclusive-cpu-pool test")
Expand All @@ -92,14 +98,16 @@ var _ = Describe("performance-exclusive-cpu-pool", func() {
})

It("One pod with only shared containers", func() {

By("Define pod")
testPod := tshelper.DefineExclusivePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

pod.RedefineWithCPUResources(testPod, "0.75", "0.5")

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start exclusive-cpu-pool test")
Expand Down
12 changes: 11 additions & 1 deletion tests/performance/tests/rt_app_no_exec_probes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package tests

import (
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-best-practices-for-k8s/certsuite-qe/tests/globalhelper"
Expand Down Expand Up @@ -46,6 +48,9 @@ var _ = Describe("performance-rt-apps-no-exec-probes", func() {
tsparams.RtImageName, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, 2*tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

command := "chrt -f -p 50 1" // To change the scheduling policy of the container start process to FIFO scheduling
Expand All @@ -71,6 +76,9 @@ var _ = Describe("performance-rt-apps-no-exec-probes", func() {
pod.RedefineWithLivenessProbe(testPod)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, 2*tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

command := "chrt -f -p 50 1" // To change the scheduling policy of the container start process to FIFO scheduling
Expand All @@ -89,7 +97,6 @@ var _ = Describe("performance-rt-apps-no-exec-probes", func() {
})

It("One non-Rt exclusive pod with no exec probes", func() {

By("Define pod")
testPod := pod.DefinePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)
Expand All @@ -99,6 +106,9 @@ var _ = Describe("performance-rt-apps-no-exec-probes", func() {

By("Create and wait until pod is ready")
err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Assert pod has modified resources")
Expand Down
14 changes: 14 additions & 0 deletions tests/performance/tests/rt_exclusive_cpu_pool_scheduling_policy.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package tests

import (
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-best-practices-for-k8s/certsuite-qe/tests/globalhelper"
Expand Down Expand Up @@ -45,6 +47,9 @@ var _ = Describe("performance-exclusive-cpu-pool-rt-scheduling-policy", func() {
tsparams.RtImageName, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start exclusive-cpu-pool-rt-scheduling-policy test")
Expand All @@ -67,6 +72,9 @@ var _ = Describe("performance-exclusive-cpu-pool-rt-scheduling-policy", func() {
tsparams.RtImageName, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Change to rt scheduling policy")
Expand Down Expand Up @@ -94,6 +102,9 @@ var _ = Describe("performance-exclusive-cpu-pool-rt-scheduling-policy", func() {
tsparams.RtImageName, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Change to rt scheduling policy")
Expand All @@ -120,6 +131,9 @@ var _ = Describe("performance-exclusive-cpu-pool-rt-scheduling-policy", func() {
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start exclusive-cpu-pool-rt-scheduling-policy test")
Expand Down
13 changes: 12 additions & 1 deletion tests/performance/tests/rt_isolated_cpu_pool.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package tests

import (
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-best-practices-for-k8s/certsuite-qe/tests/globalhelper"
Expand Down Expand Up @@ -61,6 +63,9 @@ var _ = Describe("performance-isolated-cpu-pool-rt-scheduling-policy", Serial, f
Expect(err).To(BeNil())

err = globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Change to rt scheduling policy")
Expand Down Expand Up @@ -101,7 +106,10 @@ var _ = Describe("performance-isolated-cpu-pool-rt-scheduling-policy", Serial, f
Expect(err).To(BeNil())

err = globalhelper.CreateAndWaitUntilPodIsReady(testPod, 2*tsparams.WaitingTime)
Expect(err).NotTo(HaveOccurred())
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start isolated-cpu-pool-rt-scheduling-policy test")
err = globalhelper.LaunchTests(
Expand All @@ -122,6 +130,9 @@ var _ = Describe("performance-isolated-cpu-pool-rt-scheduling-policy", Serial, f
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start isolated-cpu-pool-rt-scheduling-policy test")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package tests

import (
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-best-practices-for-k8s/certsuite-qe/tests/globalhelper"
Expand Down Expand Up @@ -40,12 +42,14 @@ var _ = Describe("performance-shared-cpu-pool-non-rt-scheduling-policy", func()
})

It("One pod with container running in shared cpu pool", func() {

By("Define pod")
testPod := pod.DefinePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start shared-cpu-pool-non-rt-scheduling-policy test")
Expand All @@ -62,7 +66,6 @@ var _ = Describe("performance-shared-cpu-pool-non-rt-scheduling-policy", func()
})

It("One pod with container running in exclusive cpu pool", func() {

By("Define pod")
testPod := pod.DefinePod(tsparams.TestPodName, randomNamespace,
globalhelper.GetConfiguration().General.TestImage, tsparams.CertsuiteTargetPodLabels)
Expand All @@ -71,6 +74,9 @@ var _ = Describe("performance-shared-cpu-pool-non-rt-scheduling-policy", func()
pod.RedefineWithMemoryResources(testPod, "512Mi", "512Mi")

err := globalhelper.CreateAndWaitUntilPodIsReady(testPod, tsparams.WaitingTime)
if strings.Contains(err.Error(), "not schedulable") {
Skip("This test cannot run because the pod is not schedulable due to insufficient resources")
}
Expect(err).ToNot(HaveOccurred())

By("Start shared-cpu-pool-non-rt-scheduling-policy test")
Expand Down

0 comments on commit 118a03b

Please sign in to comment.