mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
Merge pull request #119463 from Songjoy/cleanup-e2e-windows-framework-equal
e2e_windows: stop using deprecated framework.ExpectEqual
This commit is contained in:
commit
c723f46603
@ -724,15 +724,9 @@ var _ = SIGDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersi
|
|||||||
|
|
||||||
framework.Logf("Logs: %s\n", logs)
|
framework.Logf("Logs: %s\n", logs)
|
||||||
|
|
||||||
framework.ExpectEqual(
|
gomega.Expect(logs).Should(gomega.ContainSubstring("calling /healthz"), "app logs should contain 'calling /healthz'")
|
||||||
strings.Contains(logs, "calling /healthz"),
|
|
||||||
true,
|
|
||||||
"app logs should contain 'calling /healthz'")
|
|
||||||
|
|
||||||
framework.ExpectEqual(
|
gomega.Expect(logs).ShouldNot(gomega.ContainSubstring("status=failed"), "app logs should not contain 'status=failed'")
|
||||||
strings.Contains(logs, "status=failed"),
|
|
||||||
false,
|
|
||||||
"app logs should not contain 'status=failed")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should run as localgroup accounts", func(ctx context.Context) {
|
ginkgo.It("should run as localgroup accounts", func(ctx context.Context) {
|
||||||
@ -802,12 +796,7 @@ var _ = SIGDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersi
|
|||||||
logs, err := e2epod.GetPodLogs(ctx, f.ClientSet, f.Namespace.Name, podName, "localgroup-container")
|
logs, err := e2epod.GetPodLogs(ctx, f.ClientSet, f.Namespace.Name, podName, "localgroup-container")
|
||||||
framework.ExpectNoError(err, "error retrieving container logs")
|
framework.ExpectNoError(err, "error retrieving container logs")
|
||||||
framework.Logf("Pod logs: %s", logs)
|
framework.Logf("Pod logs: %s", logs)
|
||||||
framework.ExpectEqual(
|
gomega.Expect(strings.ToLower(logs)).ShouldNot(gomega.ContainSubstring("nt authority"), "Container runs 'whoami' and logs should not contain 'nt authority'")
|
||||||
strings.Contains(
|
|
||||||
strings.ToLower(logs),
|
|
||||||
"nt authority"),
|
|
||||||
false,
|
|
||||||
"Container runs 'whoami' and logs should not contain 'nt authority'")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
|
"github.com/onsi/gomega"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
@ -140,6 +141,6 @@ var _ = SIGDescribe("[Feature:WindowsHyperVContainers] HyperV containers", func(
|
|||||||
framework.Logf("Pod phase: %v\nlogs:\n%s", p.Status.Phase, logs)
|
framework.Logf("Pod phase: %v\nlogs:\n%s", p.Status.Phase, logs)
|
||||||
}
|
}
|
||||||
|
|
||||||
framework.ExpectEqual(p.Status.Phase, v1.PodSucceeded, "pod should have succeeded")
|
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded), "pod should have succeeded")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -34,6 +34,7 @@ import (
|
|||||||
admissionapi "k8s.io/pod-security-admission/api"
|
admissionapi "k8s.io/pod-security-admission/api"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() {
|
var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() {
|
||||||
@ -97,7 +98,7 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
framework.ExpectEqual(statsChecked, 10, "Should find stats for 10 pods in kubelet stats")
|
gomega.Expect(statsChecked).To(gomega.Equal(10), "Should find stats for 10 pods in kubelet stats")
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
@ -188,7 +189,7 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
framework.ExpectEqual(statsChecked, 3, "Should find stats for 10 pods in kubelet stats")
|
gomega.Expect(statsChecked).To(gomega.Equal(3), "Should find stats for 3 pods in kubelet stats")
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ var _ = SIGDescribe("[Feature:Windows] SecurityContext", func() {
|
|||||||
framework.ExpectNotEqual(event, nil, "event should not be empty")
|
framework.ExpectNotEqual(event, nil, "event should not be empty")
|
||||||
framework.Logf("Got event: %v", event)
|
framework.Logf("Got event: %v", event)
|
||||||
expectedEventError := "container's runAsUserName (ContainerAdministrator) which will be regarded as root identity and will break non-root policy"
|
expectedEventError := "container's runAsUserName (ContainerAdministrator) which will be regarded as root identity and will break non-root policy"
|
||||||
framework.ExpectEqual(true, strings.Contains(event.Message, expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
gomega.Expect(event.Message).Should(gomega.ContainSubstring(expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should not be able to create pods with containers running as CONTAINERADMINISTRATOR when runAsNonRoot is true", func(ctx context.Context) {
|
ginkgo.It("should not be able to create pods with containers running as CONTAINERADMINISTRATOR when runAsNonRoot is true", func(ctx context.Context) {
|
||||||
@ -188,7 +188,7 @@ var _ = SIGDescribe("[Feature:Windows] SecurityContext", func() {
|
|||||||
framework.ExpectNotEqual(event, nil, "event should not be empty")
|
framework.ExpectNotEqual(event, nil, "event should not be empty")
|
||||||
framework.Logf("Got event: %v", event)
|
framework.Logf("Got event: %v", event)
|
||||||
expectedEventError := "container's runAsUserName (CONTAINERADMINISTRATOR) which will be regarded as root identity and will break non-root policy"
|
expectedEventError := "container's runAsUserName (CONTAINERADMINISTRATOR) which will be regarded as root identity and will break non-root policy"
|
||||||
framework.ExpectEqual(true, strings.Contains(event.Message, expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
gomega.Expect(event.Message).Should(gomega.ContainSubstring(expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user