diff --git a/test/extended/pods/priorityclasses.go b/test/extended/pods/priorityclasses.go index 31bdddbc8399..9aee18b41f89 100644 --- a/test/extended/pods/priorityclasses.go +++ b/test/extended/pods/priorityclasses.go @@ -3,9 +3,11 @@ package pods import ( "context" "fmt" + "path/filepath" "strings" . "github.com/onsi/ginkgo/v2" + o "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" e2e "k8s.io/kubernetes/test/e2e/framework" @@ -88,6 +90,37 @@ var _ = Describe("[sig-arch] Managed cluster should", func() { }) }) +var _ = Describe("[sig-node] Pod priority should match the default priorityClassName values", func() { + defer GinkgoRecover() + var ( + oc = exutil.NewCLI("priority-class-name") + systemNodeCriticalPodFile = filepath.Join("testdata", "priority-class-name", "system-node-critical.yaml") + systemClusterCriticalPodFile = filepath.Join("testdata", "priority-class-name", "system-cluster-critical.yaml") + ) + + It("system-node-critical=2000001000", func() { + By("creating the pods") + err := oc.Run("create").Args("-f", systemNodeCriticalPodFile).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + + By("checking the pod priority") + out, err := oc.Run("get").Args("pods/pod-with-system-node-critical-priority-class").Template("{{.spec.priority}}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(out).To(o.Equal("2000001000")) + }) + + It("system-cluster-critical=2000000000", func() { + By("creating the pods") + err := oc.Run("create").Args("-f", systemClusterCriticalPodFile).Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + + By("checking the pod priority") + out, err := oc.Run("get").Args("pods/pod-with-system-cluster-critical-priority-class").Template("{{.spec.priority}}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + o.Expect(out).To(o.Equal("2000000000")) + }) +}) + func hasPrefixSet(name string, set sets.String) bool { for _, prefix := range set.List() { if strings.HasPrefix(name, prefix) { diff --git a/test/extended/testdata/priority-class-name/system-cluster-critical.yaml b/test/extended/testdata/priority-class-name/system-cluster-critical.yaml new file mode 100644 index 000000000000..03aa0ca7f824 --- /dev/null +++ b/test/extended/testdata/priority-class-name/system-cluster-critical.yaml @@ -0,0 +1,16 @@ +kind: Template +apiVersion: template.openshift.io/v1 +metadata: + name: template +objects: +- kind: Pod + apiVersion: v1 + metadata: + name: pod-with-system-cluster-critical-priority-class + spec: + containers: + - name: new-container + image: busybox + command: + - ls + priorityClassName: system-cluster-critical diff --git a/test/extended/testdata/priority-class-name/system-node-critical.yaml b/test/extended/testdata/priority-class-name/system-node-critical.yaml new file mode 100644 index 000000000000..c66de7b2f337 --- /dev/null +++ b/test/extended/testdata/priority-class-name/system-node-critical.yaml @@ -0,0 +1,16 @@ +kind: Template +apiVersion: template.openshift.io/v1 +metadata: + name: template +objects: +- kind: Pod + apiVersion: v1 + metadata: + name: pod-with-system-node-critical-priority-class + spec: + containers: + - name: new-container + image: busybox + command: + - ls + priorityClassName: system-node-critical diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index 7defb7c82eca..991693bab650 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -1947,6 +1947,10 @@ var Annotations = map[string]string{ "[sig-node] Managed cluster should verify that nodes have no unexpected reboots [Late]": " [Suite:openshift/conformance/parallel]", + "[sig-node] Pod priority should match the default priorityClassName values system-cluster-critical=2000000000": " [Suite:openshift/conformance/parallel]", + + "[sig-node] Pod priority should match the default priorityClassName values system-node-critical=2000001000": " [Suite:openshift/conformance/parallel]", + "[sig-node] [Conformance] Prevent openshift node labeling on update by the node TestOpenshiftNodeLabeling": " [Suite:openshift/conformance/parallel/minimal]", "[sig-node] [FeatureGate:ImageVolume] ImageVolume should fail when image does not exist": " [Suite:openshift/conformance/parallel]",