@@ -3495,8 +3495,8 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
34953495 expectAllocs : map [string ]int {tg1 : 2 , tg2 : 3 },
34963496 expectStop : map [string ]int {tg1 : 2 , tg2 : 3 },
34973497 expectDState : map [string ]* structs.DeploymentState {
3498- tg1 : {DesiredTotal : 10 , PlacedAllocs : 4 },
3499- tg2 : {DesiredTotal : 10 , PlacedAllocs : 6 },
3498+ tg1 : {DesiredTotal : 10 , PlacedAllocs : 4 }, // 2 previous + 2 destructive
3499+ tg2 : {DesiredTotal : 10 , PlacedAllocs : 6 }, // 3 previous + 3 destructive
35003500 },
35013501 },
35023502
@@ -3569,8 +3569,8 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
35693569 expectAllocs : map [string ]int {tg1 : 7 , tg2 : 10 },
35703570 expectStop : map [string ]int {tg1 : 2 , tg2 : 3 },
35713571 expectDState : map [string ]* structs.DeploymentState {
3572- tg1 : {DesiredTotal : 10 , PlacedAllocs : 7 },
3573- tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
3572+ tg1 : {DesiredTotal : 10 , PlacedAllocs : 7 }, // 2 destructive + 5 new
3573+ tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 }, // 3 destructive + 7 new
35743574 },
35753575 },
35763576
@@ -3585,21 +3585,25 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
35853585 },
35863586 existingPrevious : map [string ][]int {
35873587 tg1 : {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 },
3588- tg2 : {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 },
3588+ tg2 : {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 }, // only 8 were previously eligible
35893589 },
35903590 existingOldDState : map [string ]* structs.DeploymentState {
35913591 tg1 : {DesiredTotal : 10 , PlacedAllocs : 10 },
3592- tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
3592+ tg2 : {DesiredTotal : 8 , PlacedAllocs : 8 },
35933593 },
35943594 expectAllocs : map [string ]int {tg1 : 2 , tg2 : 5 },
35953595 expectStop : map [string ]int {tg1 : 2 , tg2 : 5 },
35963596 expectDState : map [string ]* structs.DeploymentState {
35973597 tg1 : {
35983598 DesiredTotal : 10 ,
35993599 DesiredCanaries : 3 ,
3600- PlacedAllocs : 2 ,
3600+ PlacedCanaries : []string {"0" , "1" },
3601+ PlacedAllocs : 2 , // want 3 canaries, limited by max_parallel
3602+ },
3603+ tg2 : {
3604+ DesiredTotal : 10 ,
3605+ PlacedAllocs : 7 , // 2 new + 5 destructive updates
36013606 },
3602- tg2 : {DesiredTotal : 10 , PlacedAllocs : 5 },
36033607 },
36043608 },
36053609
@@ -3645,7 +3649,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
36453649 DesiredTotal : 10 ,
36463650 DesiredCanaries : 3 ,
36473651 PlacedCanaries : []string {"7" , "8" , "9" },
3648- PlacedAllocs : 5 ,
3652+ PlacedAllocs : 5 , // 2 failed + 2 replacements + 1 new
36493653 },
36503654 tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
36513655 },
@@ -3690,7 +3694,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
36903694 DesiredTotal : 10 ,
36913695 DesiredCanaries : 3 ,
36923696 PlacedCanaries : []string {"7" , "8" , "9" },
3693- PlacedAllocs : 3 ,
3697+ PlacedAllocs : 3 , // 1 existing canary + 2 new canaries
36943698 },
36953699 tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
36963700 },
@@ -3735,7 +3739,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
37353739 DesiredTotal : 10 ,
37363740 DesiredCanaries : 3 ,
37373741 PlacedCanaries : []string {"7" , "8" , "9" },
3738- PlacedAllocs : 3 ,
3742+ PlacedAllocs : 3 , // unchanged because we're not promoted
37393743 },
37403744 tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
37413745 },
@@ -3777,7 +3781,7 @@ func TestSystemSched_UpdateBlock(t *testing.T) {
37773781 DesiredTotal : 10 ,
37783782 DesiredCanaries : 3 ,
37793783 PlacedCanaries : []string {"7" , "8" , "9" },
3780- PlacedAllocs : 5 ,
3784+ PlacedAllocs : 5 , // 3 running canaries + 2 new limited by max_parallel
37813785 },
37823786 tg2 : {DesiredTotal : 10 , PlacedAllocs : 10 },
37833787 },
0 commit comments