Skip to content

Conversation

@tgross
Copy link
Member

@tgross tgross commented Oct 3, 2025

An attempt to work up some failing unit tests for #26885 and #26886.

Ref: #26885
Ref: #26886

An attempt to work up some failing unit tests for #26885 and #26886.

Ref: #26885
Ref: #26886
Comment on lines +4038 to +4048
eligible := []string{}
for i := range 4 {
node := mock.Node()
if i%2 == 0 {
node.Attributes["kernel.name"] = "not-linux"
} else {
eligible = append(eligible, node.ID)
}
nodes[i] = node
must.NoError(t, h.State.UpsertNode(structs.MsgTypeTestSetup, h.NextIndex(), node))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eligible := []string{}
for i := range 4 {
node := mock.Node()
if i%2 == 0 {
node.Attributes["kernel.name"] = "not-linux"
} else {
eligible = append(eligible, node.ID)
}
nodes[i] = node
must.NoError(t, h.State.UpsertNode(structs.MsgTypeTestSetup, h.NextIndex(), node))
}
for i := range 4 {
node := mock.Node()
if i%2 == 0 {
node.Attributes["kernel.name"] = "not-linux"
}
nodes[i] = node
must.NoError(t, h.State.UpsertNode(structs.MsgTypeTestSetup, h.NextIndex(), node))
}

Comment on lines +4057 to +4068
existingAllocIDs := []string{}
allocs := []*structs.Allocation{}
for i := range 4 {
if i%2 != 0 {
alloc := mock.MinAllocForJob(job)
alloc.ClientStatus = structs.AllocClientStatusRunning
alloc.NodeID = nodes[i].ID
alloc.Name = structs.AllocName(job.Name, job.TaskGroups[0].Name, 0)
existingAllocIDs = append(existingAllocIDs, alloc.ID)
allocs = append(allocs, alloc)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
existingAllocIDs := []string{}
allocs := []*structs.Allocation{}
for i := range 4 {
if i%2 != 0 {
alloc := mock.MinAllocForJob(job)
alloc.ClientStatus = structs.AllocClientStatusRunning
alloc.NodeID = nodes[i].ID
alloc.Name = structs.AllocName(job.Name, job.TaskGroups[0].Name, 0)
existingAllocIDs = append(existingAllocIDs, alloc.ID)
allocs = append(allocs, alloc)
}
}
allocs := []*structs.Allocation{}
for i := range 4 {
if i%2 != 0 {
alloc := mock.MinAllocForJob(job)
alloc.ClientStatus = structs.AllocClientStatusRunning
alloc.NodeID = nodes[i].ID
alloc.Name = structs.AllocName(job.Name, job.TaskGroups[0].Name, 0)
allocs = append(allocs, alloc)
}
}

@tgross
Copy link
Member Author

tgross commented Oct 31, 2025

This has been pulled into #26953

@tgross tgross closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants