mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
e2e: use framework.ExpectEqual() for test/e2e/node
This commit is contained in:
parent
f978c4cab5
commit
03e4527a87
@ -30,7 +30,6 @@ import (
|
|||||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("Events", func() {
|
var _ = SIGDescribe("Events", func() {
|
||||||
@ -83,7 +82,7 @@ var _ = SIGDescribe("Events", func() {
|
|||||||
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value}))
|
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value}))
|
||||||
options := metav1.ListOptions{LabelSelector: selector.String()}
|
options := metav1.ListOptions{LabelSelector: selector.String()}
|
||||||
pods, err := podClient.List(options)
|
pods, err := podClient.List(options)
|
||||||
gomega.Expect(len(pods.Items)).To(gomega.Equal(1))
|
framework.ExpectEqual(len(pods.Items), 1)
|
||||||
|
|
||||||
ginkgo.By("retrieving the pod")
|
ginkgo.By("retrieving the pod")
|
||||||
podWithUID, err := podClient.Get(pod.Name, metav1.GetOptions{})
|
podWithUID, err := podClient.Get(pod.Name, metav1.GetOptions{})
|
||||||
|
@ -172,7 +172,7 @@ var _ = SIGDescribe("Mount propagation", func() {
|
|||||||
shouldBeVisible := mounts.Has(mountName)
|
shouldBeVisible := mounts.Has(mountName)
|
||||||
if shouldBeVisible {
|
if shouldBeVisible {
|
||||||
framework.ExpectNoError(err, "%s: failed to run %q", msg, cmd)
|
framework.ExpectNoError(err, "%s: failed to run %q", msg, cmd)
|
||||||
gomega.Expect(stdout).To(gomega.Equal(mountName), msg)
|
framework.ExpectEqual(stdout, mountName, msg)
|
||||||
} else {
|
} else {
|
||||||
// We *expect* cat to return error here
|
// We *expect* cat to return error here
|
||||||
framework.ExpectError(err, msg)
|
framework.ExpectError(err, msg)
|
||||||
|
@ -67,7 +67,7 @@ var _ = SIGDescribe("NodeProblemDetector [DisabledForLargeClusters]", func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gomega.Expect(len(hosts)).To(gomega.Equal(len(nodes.Items)))
|
framework.ExpectEqual(len(hosts), len(nodes.Items))
|
||||||
|
|
||||||
isStandaloneMode := make(map[string]bool)
|
isStandaloneMode := make(map[string]bool)
|
||||||
cpuUsageStats := make(map[string][]float64)
|
cpuUsageStats := make(map[string][]float64)
|
||||||
|
@ -80,7 +80,7 @@ var _ = SIGDescribe("Pods Extended", func() {
|
|||||||
options := metav1.ListOptions{LabelSelector: selector.String()}
|
options := metav1.ListOptions{LabelSelector: selector.String()}
|
||||||
pods, err := podClient.List(options)
|
pods, err := podClient.List(options)
|
||||||
framework.ExpectNoError(err, "failed to query for pod")
|
framework.ExpectNoError(err, "failed to query for pod")
|
||||||
gomega.Expect(len(pods.Items)).To(gomega.Equal(0))
|
framework.ExpectEqual(len(pods.Items), 0)
|
||||||
options = metav1.ListOptions{
|
options = metav1.ListOptions{
|
||||||
LabelSelector: selector.String(),
|
LabelSelector: selector.String(),
|
||||||
ResourceVersion: pods.ListMeta.ResourceVersion,
|
ResourceVersion: pods.ListMeta.ResourceVersion,
|
||||||
@ -94,7 +94,7 @@ var _ = SIGDescribe("Pods Extended", func() {
|
|||||||
options = metav1.ListOptions{LabelSelector: selector.String()}
|
options = metav1.ListOptions{LabelSelector: selector.String()}
|
||||||
pods, err = podClient.List(options)
|
pods, err = podClient.List(options)
|
||||||
framework.ExpectNoError(err, "failed to query for pod")
|
framework.ExpectNoError(err, "failed to query for pod")
|
||||||
gomega.Expect(len(pods.Items)).To(gomega.Equal(1))
|
framework.ExpectEqual(len(pods.Items), 1)
|
||||||
|
|
||||||
// We need to wait for the pod to be running, otherwise the deletion
|
// We need to wait for the pod to be running, otherwise the deletion
|
||||||
// may be carried out immediately rather than gracefully.
|
// may be carried out immediately rather than gracefully.
|
||||||
@ -117,7 +117,7 @@ var _ = SIGDescribe("Pods Extended", func() {
|
|||||||
output := string(buf[:n])
|
output := string(buf[:n])
|
||||||
proxyRegexp := regexp.MustCompile("Starting to serve on 127.0.0.1:([0-9]+)")
|
proxyRegexp := regexp.MustCompile("Starting to serve on 127.0.0.1:([0-9]+)")
|
||||||
match := proxyRegexp.FindStringSubmatch(output)
|
match := proxyRegexp.FindStringSubmatch(output)
|
||||||
gomega.Expect(len(match)).To(gomega.Equal(2))
|
framework.ExpectEqual(len(match), 2)
|
||||||
port, err := strconv.Atoi(match[1])
|
port, err := strconv.Atoi(match[1])
|
||||||
framework.ExpectNoError(err, "failed to convert port into string")
|
framework.ExpectNoError(err, "failed to convert port into string")
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ var _ = SIGDescribe("Pods Extended", func() {
|
|||||||
options = metav1.ListOptions{LabelSelector: selector.String()}
|
options = metav1.ListOptions{LabelSelector: selector.String()}
|
||||||
pods, err = podClient.List(options)
|
pods, err = podClient.List(options)
|
||||||
framework.ExpectNoError(err, "failed to query for pods")
|
framework.ExpectNoError(err, "failed to query for pods")
|
||||||
gomega.Expect(len(pods.Items)).To(gomega.Equal(0))
|
framework.ExpectEqual(len(pods.Items), 0)
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user