mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
enhance assertions in test/e2e/windows
Signed-off-by: hunknownz <klercc37@gmail.com>
This commit is contained in:
parent
aae07c6f7b
commit
fdb43cc5ad
@ -131,7 +131,9 @@ func runDensityBatchTest(f *framework.Framework, testArg densityTest) (time.Dura
|
||||
|
||||
for name, create := range createTimes {
|
||||
watch, ok := watchTimes[name]
|
||||
framework.ExpectEqual(ok, true)
|
||||
if !ok {
|
||||
framework.Failf("pod %s failed to be observed by the watch", name)
|
||||
}
|
||||
|
||||
e2eLags = append(e2eLags,
|
||||
e2emetrics.PodLatencyData{Name: name, Latency: watch.Time.Sub(create.Time)})
|
||||
@ -201,12 +203,16 @@ func newInformerWatchPod(f *framework.Framework, mutex *sync.Mutex, watchTimes m
|
||||
cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj interface{}) {
|
||||
p, ok := obj.(*v1.Pod)
|
||||
framework.ExpectEqual(ok, true)
|
||||
if !ok {
|
||||
framework.Failf("expected Pod, got %T", obj)
|
||||
}
|
||||
go checkPodRunning(p)
|
||||
},
|
||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||
p, ok := newObj.(*v1.Pod)
|
||||
framework.ExpectEqual(ok, true)
|
||||
if !ok {
|
||||
framework.Failf("expected Pod, got %T", newObj)
|
||||
}
|
||||
go checkPodRunning(p)
|
||||
},
|
||||
},
|
||||
|
@ -19,6 +19,7 @@ package windows
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/onsi/gomega"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -568,10 +569,10 @@ var _ = SIGDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersi
|
||||
// Note: This test performs relative comparisons to ensure metrics values were logged and does not validate specific values.
|
||||
// This done so the test can be run in parallel with other tests which may start HostProcess containers on the same node.
|
||||
ginkgo.By("Ensuring metrics were updated")
|
||||
framework.ExpectEqual(beforeMetrics.StartedContainersCount < afterMetrics.StartedContainersCount, true, "Count of started HostProcess containers should increase")
|
||||
framework.ExpectEqual(beforeMetrics.StartedContainersErrorCount < afterMetrics.StartedContainersErrorCount, true, "Count of started HostProcess errors containers should increase")
|
||||
framework.ExpectEqual(beforeMetrics.StartedInitContainersCount < afterMetrics.StartedInitContainersCount, true, "Count of started HostProcess init containers should increase")
|
||||
framework.ExpectEqual(beforeMetrics.StartedInitContainersErrorCount < afterMetrics.StartedInitContainersErrorCount, true, "Count of started HostProcess errors init containers should increase")
|
||||
gomega.Expect(beforeMetrics.StartedContainersCount).To(gomega.BeNumerically("<", afterMetrics.StartedContainersCount), "Count of started HostProcess containers should increase")
|
||||
gomega.Expect(beforeMetrics.StartedContainersErrorCount).To(gomega.BeNumerically("<", afterMetrics.StartedContainersErrorCount), "Count of started HostProcess errors containers should increase")
|
||||
gomega.Expect(beforeMetrics.StartedInitContainersCount).To(gomega.BeNumerically("<", afterMetrics.StartedInitContainersCount), "Count of started HostProcess init containers should increase")
|
||||
gomega.Expect(beforeMetrics.StartedInitContainersErrorCount).To(gomega.BeNumerically("<", afterMetrics.StartedInitContainersErrorCount), "Count of started HostProcess errors init containers should increase")
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -126,7 +126,9 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() {
|
||||
framework.Logf("Using node: %v", targetNode.Name)
|
||||
|
||||
ginkgo.By("Getting bootid")
|
||||
framework.ExpectEqual(len(targetNode.Status.NodeInfo.BootID) != 0, true, "Should find bootId in kubelet stats")
|
||||
if len(targetNode.Status.NodeInfo.BootID) == 0 {
|
||||
framework.Failf("expected bootId in kubelet stats, got none")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user