Skip to content

Commit

Permalink
allow NodeDrain test to fail fast and clean up eligibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Mar 17, 2022
1 parent ed87093 commit 7d85df6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions e2e/nodedrain/nodedrain.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (tc *NodeDrainE2ETest) AfterEach(f *framework.F) {
for _, id := range tc.nodeIDs {
_, err := e2e.Command("nomad", "node", "drain", "-disable", "-yes", id)
f.Assert().NoError(err)
_, err = e2e.Command("nomad", "node", "eligibility", "-enable", id)
f.Assert().NoError(err)
}
tc.nodeIDs = []string{}

Expand Down Expand Up @@ -140,7 +142,7 @@ func (tc *NodeDrainE2ETest) TestNodeDrainEphemeralMigrate(f *framework.F) {
// match the old allocation, not the running one
var got string
var fsErr error
testutil.WaitForResultRetries(500, func() (bool, error) {
testutil.WaitForResultRetries(10, func() (bool, error) {
time.Sleep(time.Millisecond * 100)
for _, alloc := range allocs {
if alloc["Status"] == "running" && alloc["Node ID"] != nodeID && alloc["ID"] != oldAllocID {
Expand All @@ -149,18 +151,15 @@ func (tc *NodeDrainE2ETest) TestNodeDrainEphemeralMigrate(f *framework.F) {
if err != nil {
return false, err
}
if strings.TrimSpace(got) == oldAllocID {
return true, nil
} else {
return false, fmt.Errorf("expected %q, got %q", oldAllocID, got)
}
return true, nil
}
}
return false, fmt.Errorf("did not find a migrated alloc")
return false, fmt.Errorf("missing expected allocation")
}, func(e error) {
fsErr = e
})
f.NoError(fsErr, "node drained but migration failed")
f.NoError(fsErr, "could not get allocation data")
f.Equal(oldAllocID, strings.TrimSpace(got), "node drained but migration failed")
}

// TestNodeDrainIgnoreSystem tests that system jobs are left behind when the
Expand Down

0 comments on commit 7d85df6

Please sign in to comment.