mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
system scheduler: correction to Test_computeCanaryNodes (#26707)
This commit is contained in:
committed by
GitHub
parent
276ab8a4c6
commit
a083495240
@@ -135,7 +135,7 @@ func (nr *NodeReconciler) findOldCanaryNodes(nodesList []*structs.Node, numberOf
|
||||
a *structs.Allocation, tg *structs.TaskGroup, canaryNodes map[string]map[string]bool, nodeID string) ([]*structs.Node, int) {
|
||||
|
||||
if a.DeploymentStatus == nil || a.DeploymentStatus.Canary == false ||
|
||||
nr.DeploymentCurrent == nil { // TODO: should we add this? || nr.DeploymentCurrent.ID != a.DeploymentID {
|
||||
nr.DeploymentCurrent == nil {
|
||||
return nodesList, numberOfCanaryNodes
|
||||
}
|
||||
|
||||
|
||||
@@ -895,6 +895,7 @@ func Test_computeCanaryNodes(t *testing.T) {
|
||||
DeploymentStatus: &structs.AllocDeploymentStatus{
|
||||
Canary: true,
|
||||
},
|
||||
TaskGroup: "foo",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -925,6 +926,26 @@ func Test_computeCanaryNodes(t *testing.T) {
|
||||
fiveEligibleNodeNames[2]: "foo",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "task group with 100% canary deploy, 1 eligible node",
|
||||
nodes: map[string]*structs.Node{"foo": mock.Node()},
|
||||
liveAllocs: nil,
|
||||
terminalAllocs: nil,
|
||||
required: map[string]*structs.TaskGroup{
|
||||
"foo": {
|
||||
Name: "foo",
|
||||
Update: &structs.UpdateStrategy{
|
||||
Canary: 100,
|
||||
MaxParallel: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
existingDeployment: nil,
|
||||
expectedCanaryNodes: map[string]int{
|
||||
"foo": 1,
|
||||
},
|
||||
expectedCanaryNodeID: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user