cleanup:e2e-cloud:stop using deprecated framework.ExpectNotEqual

This commit is contained in:
jinye 2023-10-11 20:39:50 +08:00
parent add482a2d3
commit e20ecbe1b4
2 changed files with 5 additions and 4 deletions

View File

@ -31,6 +31,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() {
@ -54,7 +55,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)
@ -62,7 +63,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
@ -78,7 +79,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("[Disruptive]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)