Add v1.25 test and reduce amount of e2e tests (#9018)
This commit is contained in:
parent
92534fa2ae
commit
bfd44ab83e
5 changed files with 42 additions and 11 deletions
|
|
@ -19,6 +19,7 @@ package settings
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
|
|
@ -41,8 +42,22 @@ var _ = framework.IngressNginxDescribe("[Security] Pod Security Policies", func(
|
|||
f := framework.NewDefaultFramework("pod-security-policies")
|
||||
|
||||
ginkgo.It("should be running with a Pod Security Policy", func() {
|
||||
k8sversion, err := f.KubeClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "getting version")
|
||||
}
|
||||
|
||||
numversion, err := strconv.Atoi(k8sversion.Minor)
|
||||
if err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "converting version")
|
||||
}
|
||||
|
||||
if numversion > 24 {
|
||||
ginkgo.Skip("PSP not supported in this version")
|
||||
}
|
||||
|
||||
psp := createPodSecurityPolicy()
|
||||
_, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(context.TODO(), psp, metav1.CreateOptions{})
|
||||
_, err = f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(context.TODO(), psp, metav1.CreateOptions{})
|
||||
if !k8sErrors.IsAlreadyExists(err) {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "creating Pod Security Policy")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package settings
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
|
|
@ -37,8 +38,22 @@ var _ = framework.IngressNginxDescribe("[Security] Pod Security Policies with vo
|
|||
f := framework.NewDefaultFramework("pod-security-policies-volumes")
|
||||
|
||||
ginkgo.It("should be running with a Pod Security Policy", func() {
|
||||
|
||||
k8sversion, err := f.KubeClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "getting version")
|
||||
}
|
||||
|
||||
numversion, err := strconv.Atoi(k8sversion.Minor)
|
||||
if err != nil {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "converting version")
|
||||
}
|
||||
|
||||
if numversion > 24 {
|
||||
ginkgo.Skip("PSP not supported in this version")
|
||||
}
|
||||
psp := createPodSecurityPolicy()
|
||||
_, err := f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(context.TODO(), psp, metav1.CreateOptions{})
|
||||
_, err = f.KubeClientSet.PolicyV1beta1().PodSecurityPolicies().Create(context.TODO(), psp, metav1.CreateOptions{})
|
||||
if !k8sErrors.IsAlreadyExists(err) {
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "creating Pod Security Policy")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue