Merge pull request #121146 from shijinye/e2ecleanup-cloud-notequal

cleanup:e2e-cloud:stop using deprecated framework.ExpectNotEqual
This commit is contained in:
Kubernetes Prow Robot 2024-02-05 08:44:53 -08:00 committed by GitHub
commit 35531ae707
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -32,6 +32,7 @@ import (
admissionapi "k8s.io/pod-security-admission/api"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
var _ = SIGDescribe("Ports Security Check", feature.KubeletSecurity, func() {
@ -55,7 +56,7 @@ var _ = SIGDescribe("Ports Security Check", feature.KubeletSecurity, func() {
var statusCode int
result.StatusCode(&statusCode)
framework.ExpectNotEqual(statusCode, http.StatusOK)
gomega.Expect(statusCode).ToNot(gomega.Equal(http.StatusOK))
})
ginkgo.It("should not be able to proxy to cadvisor port 4194 using proxy subresource", func(ctx context.Context) {
result, err := e2ekubelet.ProxyRequest(ctx, f.ClientSet, nodeName, "containers/", 4194)
@ -63,7 +64,7 @@ var _ = SIGDescribe("Ports Security Check", feature.KubeletSecurity, func() {
var statusCode int
result.StatusCode(&statusCode)
framework.ExpectNotEqual(statusCode, http.StatusOK)
gomega.Expect(statusCode).ToNot(gomega.Equal(http.StatusOK))
})
// make sure kubelet readonly (10255) and cadvisor (4194) ports are closed on the public IP address
@ -79,7 +80,7 @@ var _ = SIGDescribe("Ports Security Check", feature.KubeletSecurity, func() {
// checks whether the target port is closed
func portClosedTest(f *framework.Framework, pickNode *v1.Node, port int) {
nodeAddrs := e2enode.GetAddresses(pickNode, v1.NodeExternalIP)
framework.ExpectNotEqual(len(nodeAddrs), 0)
gomega.Expect(nodeAddrs).ToNot(gomega.BeEmpty())
for _, addr := range nodeAddrs {
conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", addr, port), 1*time.Minute)

View File

@ -149,7 +149,7 @@ var _ = SIGDescribe(framework.WithDisruptive(), "NodeLease", func() {
deletedNodeName = originalNodeName
break
}
framework.ExpectNotEqual(deletedNodeName, "")
gomega.Expect(deletedNodeName).NotTo(gomega.BeEmpty())
gomega.Eventually(ctx, func() error {
if _, err := leaseClient.Get(ctx, deletedNodeName, metav1.GetOptions{}); err == nil {
return fmt.Errorf("node lease is not deleted yet for node %q", deletedNodeName)