mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 02:06:23 +00:00
Merge pull request #137978 from ania-borowiec/flake
Fix flakiness in integration test for TopologyAwareScheduling with Basic Policy
This commit is contained in:
@@ -893,7 +893,7 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify the entire gang is now scheduled",
|
||||
name: "Verify the entire podgroup is now scheduled",
|
||||
waitForPodsScheduled: []string{"p1", "p2", "p3"},
|
||||
},
|
||||
// Each node has 2 CPUs, each of gang pods requests 1 CPU.
|
||||
@@ -993,9 +993,21 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
createPodGroup: makeBasicPodGroup("pg1", "rack"),
|
||||
},
|
||||
{
|
||||
name: "Create all pods belonging to the podgroup",
|
||||
// Fixing test flakiness:
|
||||
// To make the test behave deterministically, first create 1 pod, based on which scores will be
|
||||
// calculated, and only add more pods once the first is scheduled.
|
||||
name: "Create the first pod belonging to the podgroup",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p1", "pg1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify the pod is scheduled",
|
||||
waitForPodsScheduled: []string{"p1"},
|
||||
},
|
||||
{
|
||||
name: "Create other pods belonging to the podgroup",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p2", "pg1"),
|
||||
makePod("p3", "pg1"),
|
||||
},
|
||||
@@ -1007,8 +1019,8 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
// - rack1: 3/8 = 0.375
|
||||
// - rack2: 1/2 = 0.5
|
||||
{
|
||||
name: "Verify that the first two pods are now scheduled",
|
||||
waitForPodsScheduled: []string{"p1", "p2"},
|
||||
name: "Verify one of the additional pods is scheduled",
|
||||
waitForPodsScheduled: []string{"p2"},
|
||||
},
|
||||
{
|
||||
name: "Verify pod scheduled on rack2",
|
||||
@@ -1199,13 +1211,46 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
createPodGroup: makeBasicPodGroup("pg1", "rack"),
|
||||
},
|
||||
{
|
||||
name: "Create all pods belonging to podgroup pg1",
|
||||
// Fixing test flakiness:
|
||||
// To make the test behave deterministically, first create 1 pod, based on which scores will be
|
||||
// calculated, and only add more pods once the first is scheduled.
|
||||
name: "Create the first pod belonging to the podgroup",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p1", "pg1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify the pod is scheduled",
|
||||
waitForPodsScheduled: []string{"p1"},
|
||||
},
|
||||
{
|
||||
name: "Create other pods belonging to the podgroup",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p2", "pg1"),
|
||||
makePod("p3", "pg1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify the first of additional pods in pg1 is now scheduled",
|
||||
waitForPodsScheduled: []string{"p2"},
|
||||
},
|
||||
{
|
||||
name: "Verify the last pod becomes unschedulable due to insufficient resources",
|
||||
waitForPodsUnschedulable: []string{"p3"},
|
||||
},
|
||||
// Each node has 2 CPUs, each of gang pods requests 1 CPU.
|
||||
// Scores are first calculated when scheduling the first pod, without the knowledge how many pods would be in the podgroup.
|
||||
// PodGroupPodsCount will score the same for each rack (because both racks can fit the first pod).
|
||||
// Allocation fractions in racks (for the default "most allocated" strategy the highest allocation is picked):
|
||||
// - rack1: 1/4 = 0.25
|
||||
// - rack2: 1/2 = 0.5
|
||||
{
|
||||
name: "Verify all pods in pg1 scheduled on rack2 (which scored higher allocation)",
|
||||
verifyAssignments: &verifyAssignments{
|
||||
pods: []string{"p1", "p2"},
|
||||
nodes: sets.New("node3-rack2"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Create the PodGroup object that should be scheduled on one rack",
|
||||
createPodGroup: makeBasicPodGroup("pg2", "rack"),
|
||||
@@ -1218,27 +1263,6 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
makePod("p6", "pg2"),
|
||||
},
|
||||
},
|
||||
// Each node has 2 CPUs, each of gang pods requests 1 CPU.
|
||||
// Scores are first calculated when scheduling the first pod, without the knowledge how many pods would be in the podgroup.
|
||||
// PodGroupPodsCount will score the same for each rack (because both racks can fit the first pod).
|
||||
// Allocation fractions in racks (for the default "most allocated" strategy the highest allocation is picked):
|
||||
// - rack1: 1/4 = 0.25
|
||||
// - rack2: 1/2 = 0.5
|
||||
{
|
||||
name: "Verify part of podgroup p1 is now scheduled",
|
||||
waitForPodsScheduled: []string{"p1", "p2"},
|
||||
},
|
||||
{
|
||||
name: "Verify all pods in pg1 scheduled on rack2 (which scored higher allocation)",
|
||||
verifyAssignments: &verifyAssignments{
|
||||
pods: []string{"p1", "p2"},
|
||||
nodes: sets.New("node3-rack2"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify the last pod becomes unschedulable due to insufficient resources",
|
||||
waitForPodsUnschedulable: []string{"p3"},
|
||||
},
|
||||
{
|
||||
name: "Verify the entire podgroup pg2 is now scheduled",
|
||||
waitForPodsScheduled: []string{"p4", "p5", "p6"},
|
||||
@@ -1268,21 +1292,33 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
makeAssignedPod("existing1", "node1-rack1", "1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify that the blocker pod got scheduled",
|
||||
waitForPodsScheduled: []string{"existing1"},
|
||||
},
|
||||
{
|
||||
name: "Create the PodGroup object that should be scheduled on one rack",
|
||||
createPodGroup: makeBasicPodGroup("pg1", "rack"),
|
||||
},
|
||||
{
|
||||
name: "Create all pods belonging to the podgroup, more than fitting in rack1",
|
||||
// Fixing test flakiness:
|
||||
// To make the test behave deterministically, first create 1 pod, based on which scores will be
|
||||
// calculated, and only add more pods once the first is scheduled.
|
||||
name: "Create the first pod belonging to the podgroup",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p1", "pg1"),
|
||||
makePod("p2", "pg1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify that 1 pod got scheduled",
|
||||
name: "Verify the pod is scheduled",
|
||||
waitForPodsScheduled: []string{"p1"},
|
||||
},
|
||||
{
|
||||
name: "Create other pods belonging to the podgroup, exceeding the capacity of rack1",
|
||||
createPods: []*v1.Pod{
|
||||
makePod("p2", "pg1"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify that p1 got scheduled on rack1, which scored higher in mostAllocated strategy",
|
||||
verifyAssignments: &verifyAssignments{
|
||||
@@ -1291,7 +1327,7 @@ func TestTopologyAwareSchedulingWithBasicPolicy(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Verify that the last pod becomes unschedulable due to insufficient resources in the rack",
|
||||
name: "Verify that the other pod becomes unschedulable due to insufficient resources in the rack",
|
||||
waitForPodsUnschedulable: []string{"p2"},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user