Skip to content

Commit f96bff6

Browse files
tgrosspkazmierczak
authored andcommitted
system deployment tests: fix and annotate counts (#27006)
Fix some previously broken counts in the system deployments test and add comments to most of the placement counts to make it a little easier to read the test and verify it's correct.
1 parent 9c66203 commit f96bff6

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

scheduler/scheduler_system_test.go

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,8 +3473,8 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
34733473
expectAllocs: map[string]int{tg1: 2, tg2: 3},
34743474
expectStop: map[string]int{tg1: 2, tg2: 3},
34753475
expectDState: map[string]*structs.DeploymentState{
3476-
tg1: {DesiredTotal: 10, PlacedAllocs: 4},
3477-
tg2: {DesiredTotal: 10, PlacedAllocs: 6},
3476+
tg1: {DesiredTotal: 10, PlacedAllocs: 4}, // 2 previous + 2 destructive
3477+
tg2: {DesiredTotal: 10, PlacedAllocs: 6}, // 3 previous + 3 destructive
34783478
},
34793479
},
34803480

@@ -3547,8 +3547,8 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
35473547
expectAllocs: map[string]int{tg1: 7, tg2: 10},
35483548
expectStop: map[string]int{tg1: 2, tg2: 3},
35493549
expectDState: map[string]*structs.DeploymentState{
3550-
tg1: {DesiredTotal: 10, PlacedAllocs: 7},
3551-
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
3550+
tg1: {DesiredTotal: 10, PlacedAllocs: 7}, // 2 destructive + 5 new
3551+
tg2: {DesiredTotal: 10, PlacedAllocs: 10}, // 3 destructive + 7 new
35523552
},
35533553
},
35543554

@@ -3563,21 +3563,25 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
35633563
},
35643564
existingPrevious: map[string][]int{
35653565
tg1: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3566-
tg2: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
3566+
tg2: {0, 1, 2, 3, 4, 5, 6, 7}, // only 8 were previously eligible
35673567
},
35683568
existingOldDState: map[string]*structs.DeploymentState{
35693569
tg1: {DesiredTotal: 10, PlacedAllocs: 10},
3570-
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
3570+
tg2: {DesiredTotal: 8, PlacedAllocs: 8},
35713571
},
35723572
expectAllocs: map[string]int{tg1: 2, tg2: 5},
35733573
expectStop: map[string]int{tg1: 2, tg2: 5},
35743574
expectDState: map[string]*structs.DeploymentState{
35753575
tg1: {
35763576
DesiredTotal: 10,
35773577
DesiredCanaries: 3,
3578-
PlacedAllocs: 2,
3578+
PlacedCanaries: []string{"0", "1"},
3579+
PlacedAllocs: 2, // want 3 canaries, limited by max_parallel
3580+
},
3581+
tg2: {
3582+
DesiredTotal: 10,
3583+
PlacedAllocs: 7, // 2 new + 5 destructive updates
35793584
},
3580-
tg2: {DesiredTotal: 10, PlacedAllocs: 5},
35813585
},
35823586
},
35833587

@@ -3623,7 +3627,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
36233627
DesiredTotal: 10,
36243628
DesiredCanaries: 3,
36253629
PlacedCanaries: []string{"7", "8", "9"},
3626-
PlacedAllocs: 5,
3630+
PlacedAllocs: 5, // 2 failed + 2 replacements + 1 new
36273631
},
36283632
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
36293633
},
@@ -3668,7 +3672,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
36683672
DesiredTotal: 10,
36693673
DesiredCanaries: 3,
36703674
PlacedCanaries: []string{"7", "8", "9"},
3671-
PlacedAllocs: 3,
3675+
PlacedAllocs: 3, // 1 existing canary + 2 new canaries
36723676
},
36733677
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
36743678
},
@@ -3713,7 +3717,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
37133717
DesiredTotal: 10,
37143718
DesiredCanaries: 3,
37153719
PlacedCanaries: []string{"7", "8", "9"},
3716-
PlacedAllocs: 3,
3720+
PlacedAllocs: 3, // unchanged because we're not promoted
37173721
},
37183722
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
37193723
},
@@ -3755,7 +3759,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
37553759
DesiredTotal: 10,
37563760
DesiredCanaries: 3,
37573761
PlacedCanaries: []string{"7", "8", "9"},
3758-
PlacedAllocs: 5,
3762+
PlacedAllocs: 5, // 3 running canaries + 2 new limited by max_parallel
37593763
},
37603764
tg2: {DesiredTotal: 10, PlacedAllocs: 10},
37613765
},

0 commit comments

Comments
 (0)