mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Scheduler predicate test explicitly assumes that cluster add-on pods stay stable, but never check it before each test run. Adding the check for each test case.
This commit is contained in:
parent
b32078d89b
commit
d65cab42bf
@ -179,6 +179,7 @@ func waitForStableCluster(c *client.Client) int {
|
|||||||
var _ = Describe("SchedulerPredicates [Serial]", func() {
|
var _ = Describe("SchedulerPredicates [Serial]", func() {
|
||||||
var c *client.Client
|
var c *client.Client
|
||||||
var nodeList *api.NodeList
|
var nodeList *api.NodeList
|
||||||
|
var systemPodsNo int
|
||||||
var totalPodCapacity int64
|
var totalPodCapacity int64
|
||||||
var RCName string
|
var RCName string
|
||||||
var ns string
|
var ns string
|
||||||
@ -198,6 +199,16 @@ var _ = Describe("SchedulerPredicates [Serial]", func() {
|
|||||||
c = framework.Client
|
c = framework.Client
|
||||||
ns = framework.Namespace.Name
|
ns = framework.Namespace.Name
|
||||||
nodeList = ListSchedulableNodesOrDie(c)
|
nodeList = ListSchedulableNodesOrDie(c)
|
||||||
|
|
||||||
|
// Every test case in this suite assumes that cluster add-on pods stay stable and
|
||||||
|
// cannot be run in parallel with any other test that touches Nodes or Pods.
|
||||||
|
// It is so because we need to have precise control on what's running in the cluster.
|
||||||
|
systemPods, err := c.Pods(api.NamespaceSystem).List(api.ListOptions{})
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
systemPodsNo = len(systemPods.Items)
|
||||||
|
|
||||||
|
err = waitForPodsRunningReady(api.NamespaceSystem, systemPodsNo, podReadyBeforeTimeout)
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
// This test verifies that max-pods flag works as advertised. It assumes that cluster add-on pods stay stable
|
// This test verifies that max-pods flag works as advertised. It assumes that cluster add-on pods stay stable
|
||||||
@ -284,7 +295,7 @@ var _ = Describe("SchedulerPredicates [Serial]", func() {
|
|||||||
_, found := nodeToCapacityMap[pod.Spec.NodeName]
|
_, found := nodeToCapacityMap[pod.Spec.NodeName]
|
||||||
Expect(found).To(Equal(true))
|
Expect(found).To(Equal(true))
|
||||||
if pod.Status.Phase == api.PodRunning {
|
if pod.Status.Phase == api.PodRunning {
|
||||||
Logf("Pod %v requesting capacity %v on Node %v", pod.Name, getRequestedCPU(pod), pod.Spec.NodeName)
|
Logf("Pod %v requesting resource %v on Node %v", pod.Name, getRequestedCPU(pod), pod.Spec.NodeName)
|
||||||
nodeToCapacityMap[pod.Spec.NodeName] -= getRequestedCPU(pod)
|
nodeToCapacityMap[pod.Spec.NodeName] -= getRequestedCPU(pod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user