Skip to content

Commit 0a1fbb0

Browse files
committed
e2e: serial: generalize requiredNUMAZones
promote it to top-level variable, it's a hidden assumptions everywhere anyway, let's make it obvious and consistent. Signed-off-by: Francesco Romani <fromani@redhat.com>
1 parent 9621753 commit 0a1fbb0

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

test/e2e/serial/tests/workload_unschedulable.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
6363
var nrtList nrtv1alpha2.NodeResourceTopologyList
6464
var nrts []nrtv1alpha2.NodeResourceTopology
6565
var tmScope string
66+
var requiredNUMAZones int
6667

6768
BeforeEach(func() {
69+
requiredNUMAZones = 2 // TODO: exactly 2. Adjust (among many other instances) when we get machines with more than 2 NUMA zones.
70+
6871
Expect(serialconfig.Config).ToNot(BeNil())
6972

7073
var err error
@@ -84,9 +87,9 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
8487
e2efixture.Skipf(fxt, "not enough nodes with valid policy - found %d", len(nrts))
8588
}
8689

87-
nrts = e2enrt.FilterZoneCountEqual(nrts, 2)
88-
if len(nrts) < 2 {
89-
e2efixture.Skipf(fxt, "not enough nodes with %d NUMA zones - found %d", 2, len(nrts))
90+
nrts = e2enrt.FilterZoneCountEqual(nrts, requiredNUMAZones)
91+
if len(nrts) < requiredNUMAZones {
92+
e2efixture.Skipf(fxt, "not enough nodes with %d NUMA zones - found %d", requiredNUMAZones, len(nrts))
9093
}
9194

9295
// we expect having the same policy across all NRTs
@@ -116,7 +119,6 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
116119
BeforeEach(func() {
117120
neededNodes := 1
118121

119-
requiredNUMAZones := 2
120122
By(fmt.Sprintf("filtering available nodes with at least %d NUMA zones", requiredNUMAZones))
121123
nrtCandidates = e2enrt.FilterZoneCountEqual(nrts, requiredNUMAZones)
122124
if len(nrtCandidates) < neededNodes {
@@ -323,7 +325,6 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
323325

324326
Context("with at least two nodes with two numa zones and enough resources in one numa zone", func() {
325327
It("[test_id:47592] a daemonset with a guaranteed pod resources available on one node/one single numa zone but not in any other node", Label(label.Tier2, "unsched", "failalign"), func() {
326-
requiredNUMAZones := 2
327328
By(fmt.Sprintf("filtering available nodes with at least %d NUMA zones", requiredNUMAZones))
328329
nrtCandidates := e2enrt.FilterZoneCountEqual(nrts, requiredNUMAZones)
329330

@@ -455,8 +456,6 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
455456
// Requirements:
456457
// Need at least this nodes
457458
neededNodes := 1
458-
// with at least this number of numa zones
459-
requiredNUMAZones := 2
460459
// and with this policy/scope
461460
tmPolicy := intnrt.SingleNUMANode
462461
tmScope := intnrt.Pod
@@ -645,7 +644,7 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
645644
xload := resourcelist.Highest(ress...)
646645
klog.Infof("highest base load resource cost (overall): %s", resourcelist.ToString(xload))
647646

648-
labSel, err := labels.Parse(serialconfig.MultiNUMALabel + "=2")
647+
labSel, err := labels.Parse(fmt.Sprintf("%s=%d", serialconfig.MultiNUMALabel, requiredNUMAZones))
649648
Expect(err).ToNot(HaveOccurred())
650649
nodesNameSet := e2enrt.AccumulateNames(nrts)
651650

@@ -667,7 +666,7 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
667666
nrtInitialList := e2efixture.MustSettleNRT(fxt)
668667

669668
dpName := "test-dp-47615"
670-
replicas := int32(len(nrts)*2 + 1) // at least 1 replica won't fit
669+
replicas := int32(len(nrts)*requiredNUMAZones + 1) // at least 1 replica won't fit
671670
By(fmt.Sprintf("creating a deployment %q with replicas %d candidate nodes %d", dpName, replicas, len(nrts)))
672671

673672
nroSchedObj := nrosched.CheckNROSchedulerAvailable(ctx, fxt.Client, objectnames.DefaultNUMAResourcesSchedulerCrName)
@@ -759,7 +758,7 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
759758
// we should expect 'expectedReadyReplicas' out of total replica pods to be running
760759
// each NUMA cell should hold a single pod, so we should expect the number of replicas to be equal to number of available NUMAs
761760
// multiNUMACandidates nodes has 2 NUMAs each
762-
expectedReadyReplicas := int32(len(nrts) * 2)
761+
expectedReadyReplicas := int32(len(nrts) * requiredNUMAZones)
763762

764763
By("updating deployment in such way that some pods will fit into NUMA nodes")
765764
var updateAttempt int
@@ -827,7 +826,6 @@ var _ = Describe("[serial][disruptive][scheduler] numaresources workload unsched
827826
var err error
828827

829828
BeforeEach(func() {
830-
const requiredNUMAZones = 2
831829
By(fmt.Sprintf("filtering available nodes with at least %d NUMA zones", requiredNUMAZones))
832830
nrtCandidates = e2enrt.FilterZoneCountEqual(nrts, requiredNUMAZones)
833831

0 commit comments

Comments
 (0)