diff --git a/nomad/fsm.go b/nomad/fsm.go index 7d0ef4fc4..0a004c836 100644 --- a/nomad/fsm.go +++ b/nomad/fsm.go @@ -1104,7 +1104,7 @@ func (n *nomadFSM) Restore(old io.ReadCloser) error { return nil } -// reconcileSummaries re-calculates the queued allocations for every job that we +// reconcileQueuedAllocations re-calculates the queued allocations for every job that we // created a Job Summary during the snap shot restore func (n *nomadFSM) reconcileQueuedAllocations(index uint64) error { // Get all the jobs @@ -1142,7 +1142,7 @@ func (n *nomadFSM) reconcileQueuedAllocations(index uint64) error { Status: structs.EvalStatusPending, AnnotatePlan: true, } - + snap.UpsertEvals(100, []*structs.Evaluation{eval}) // Create the scheduler and run it sched, err := scheduler.NewScheduler(eval.Type, n.logger, snap, planner) if err != nil { diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 92e9605a7..98e1d5580 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -1501,10 +1501,7 @@ func (s *StateStore) updateEvalModifyIndex(txn *memdb.Txn, index uint64, evalID return fmt.Errorf("eval lookup failed: %v", err) } if existing == nil { - // return if there isn't an eval with this ID. - // In some cases (like snapshot restores), we process evals that are not already in the state store. - s.logger.Printf("[WARN] state_store: unable to find eval ID %v, cannot update modify index ", evalID) - return nil + return fmt.Errorf("[ERR] state_store: unable to find eval id %q", evalID) } eval := existing.(*structs.Evaluation).Copy() // Update the indexes diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index 02296ff76..0e88b4255 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -35,8 +35,11 @@ func TestServiceSched_JobRegister(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -118,7 +121,9 @@ func TestServiceSched_JobRegister_StickyAllocs(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewServiceScheduler, eval); err != nil { @@ -149,7 +154,9 @@ func TestServiceSched_JobRegister_StickyAllocs(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) h1 := NewHarnessWithState(t, h.State) if err := h1.Process(NewServiceScheduler, eval); err != nil { t.Fatalf("err: %v", err) @@ -206,8 +213,11 @@ func TestServiceSched_JobRegister_DiskConstraints(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -275,8 +285,11 @@ func TestServiceSched_JobRegister_DistinctHosts(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -364,8 +377,11 @@ func TestServiceSched_JobRegister_DistinctProperty(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -456,7 +472,9 @@ func TestServiceSched_JobRegister_DistinctProperty_TaskGroup(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -548,7 +566,9 @@ func TestServiceSched_JobRegister_DistinctProperty_TaskGroup_Incr(t *testing.T) Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation assert.Nil(h.Process(NewServiceScheduler, eval), "Process") @@ -602,7 +622,9 @@ func TestServiceSched_JobRegister_Annotate(t *testing.T) { TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, AnnotatePlan: true, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -679,7 +701,9 @@ func TestServiceSched_JobRegister_CountZero(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -720,8 +744,11 @@ func TestServiceSched_JobRegister_AllocFail(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -802,8 +829,11 @@ func TestServiceSched_JobRegister_CreateBlockedEval(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -899,8 +929,9 @@ func TestServiceSched_JobRegister_FeasibleAndInfeasibleTG(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -1016,8 +1047,11 @@ func TestServiceSched_Plan_Partial_Progress(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -1245,7 +1279,9 @@ func TestServiceSched_JobModify(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1329,7 +1365,9 @@ func TestServiceSched_JobModify_IncrCount_NodeLimit(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1436,7 +1474,9 @@ func TestServiceSched_JobModify_CountZero(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1530,7 +1570,9 @@ func TestServiceSched_JobModify_Rolling(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1635,7 +1677,9 @@ func TestServiceSched_JobModify_Rolling_FullNode(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1736,7 +1780,9 @@ func TestServiceSched_JobModify_Canaries(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1844,7 +1890,9 @@ func TestServiceSched_JobModify_InPlace(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1958,7 +2006,9 @@ func TestServiceSched_JobModify_DistinctProperty(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2044,7 +2094,9 @@ func TestServiceSched_JobDeregister_Purged(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobDeregister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2111,7 +2163,9 @@ func TestServiceSched_JobDeregister_Stopped(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobDeregister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2201,7 +2255,9 @@ func TestServiceSched_NodeDown(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2267,7 +2323,9 @@ func TestServiceSched_NodeUpdate(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2318,7 +2376,9 @@ func TestServiceSched_NodeDrain(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2419,8 +2479,11 @@ func TestServiceSched_NodeDrain_Down(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -2493,7 +2556,9 @@ func TestServiceSched_NodeDrain_Queued_Allocations(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2550,7 +2615,9 @@ func TestServiceSched_NodeDrain_UpdateStrategy(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2608,7 +2675,9 @@ func TestServiceSched_RetryLimit(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -2664,7 +2733,9 @@ func TestBatchSched_Run_CompleteAlloc(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -2719,7 +2790,9 @@ func TestBatchSched_Run_FailedAlloc(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -2781,7 +2854,9 @@ func TestBatchSched_Run_FailedAllocQueuedAllocations(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -2841,7 +2916,9 @@ func TestBatchSched_ReRun_SuccessfullyFinishedAlloc(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -2904,7 +2981,9 @@ func TestBatchSched_JobModify_InPlace_Terminal(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -2985,7 +3064,9 @@ func TestBatchSched_JobModify_Destructive_Terminal(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewBatchScheduler, eval) @@ -3039,8 +3120,11 @@ func TestBatchSched_NodeDrain_Running_OldJob(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewBatchScheduler, eval) if err != nil { @@ -3102,8 +3186,11 @@ func TestBatchSched_NodeDrain_Complete(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewBatchScheduler, eval) if err != nil { @@ -3154,8 +3241,11 @@ func TestBatchSched_ScaleDown_SameName(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewBatchScheduler, eval) if err != nil { @@ -3197,7 +3287,9 @@ func TestGenericSched_ChainedAlloc(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewServiceScheduler, eval); err != nil { t.Fatalf("err: %v", err) @@ -3226,7 +3318,10 @@ func TestGenericSched_ChainedAlloc(t *testing.T) { Priority: job1.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job1.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval1})) + // Process the evaluation if err := h1.Process(NewServiceScheduler, eval1); err != nil { t.Fatalf("err: %v", err) @@ -3287,8 +3382,11 @@ func TestServiceSched_NodeDrain_Sticky(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: alloc.Job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -3344,8 +3442,11 @@ func TestServiceSched_CancelDeployment_Stopped(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobDeregister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -3413,8 +3514,11 @@ func TestServiceSched_CancelDeployment_NewerJob(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) + // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { diff --git a/scheduler/system_sched_test.go b/scheduler/system_sched_test.go index be43026a1..2e0535500 100644 --- a/scheduler/system_sched_test.go +++ b/scheduler/system_sched_test.go @@ -32,7 +32,9 @@ func TestSystemSched_JobRegister(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -105,7 +107,9 @@ func TestSystemeSched_JobRegister_StickyAllocs(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewSystemScheduler, eval); err != nil { @@ -134,7 +138,9 @@ func TestSystemeSched_JobRegister_StickyAllocs(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) h1 := NewHarnessWithState(t, h.State) if err := h1.Process(NewSystemScheduler, eval); err != nil { t.Fatalf("err: %v", err) @@ -181,7 +187,9 @@ func TestSystemSched_JobRegister_EphemeralDiskConstraint(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewSystemScheduler, eval); err != nil { @@ -207,7 +215,9 @@ func TestSystemSched_JobRegister_EphemeralDiskConstraint(t *testing.T) { Priority: job1.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job1.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h1.Process(NewSystemScheduler, eval1); err != nil { @@ -241,8 +251,9 @@ func TestSystemSched_ExhaustResources(t *testing.T) { Priority: svcJob.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: svcJob.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) if err != nil { @@ -260,8 +271,9 @@ func TestSystemSched_ExhaustResources(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewSystemScheduler, eval1); err != nil { t.Fatalf("err: %v", err) @@ -307,7 +319,9 @@ func TestSystemSched_JobRegister_Annotate(t *testing.T) { TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, AnnotatePlan: true, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -405,8 +419,9 @@ func TestSystemSched_JobRegister_AddNode(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) if err != nil { @@ -472,8 +487,9 @@ func TestSystemSched_JobRegister_AllocFail(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) if err != nil { @@ -542,7 +558,9 @@ func TestSystemSched_JobModify(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -633,8 +651,9 @@ func TestSystemSched_JobModify_Rolling(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } - + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) if err != nil { @@ -728,7 +747,9 @@ func TestSystemSched_JobModify_InPlace(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -822,7 +843,9 @@ func TestSystemSched_JobDeregister_Purged(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobDeregister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -894,7 +917,9 @@ func TestSystemSched_JobDeregister_Stopped(t *testing.T) { Priority: 50, TriggeredBy: structs.EvalTriggerJobDeregister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -956,7 +981,9 @@ func TestSystemSched_NodeDown(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1021,7 +1048,9 @@ func TestSystemSched_NodeDrain_Down(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewServiceScheduler, eval) @@ -1080,7 +1109,9 @@ func TestSystemSched_NodeDrain(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1143,7 +1174,9 @@ func TestSystemSched_NodeUpdate(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1180,7 +1213,9 @@ func TestSystemSched_RetryLimit(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1230,7 +1265,9 @@ func TestSystemSched_Queued_With_Constraints(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1264,7 +1301,9 @@ func TestSystemSched_ChainedAlloc(t *testing.T) { Priority: job.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation if err := h.Process(NewSystemScheduler, eval); err != nil { t.Fatalf("err: %v", err) @@ -1299,7 +1338,9 @@ func TestSystemSched_ChainedAlloc(t *testing.T) { Priority: job1.Priority, TriggeredBy: structs.EvalTriggerJobRegister, JobID: job1.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval1})) // Process the evaluation if err := h1.Process(NewSystemScheduler, eval1); err != nil { t.Fatalf("err: %v", err) @@ -1389,7 +1430,9 @@ func TestSystemSched_PlanWithDrainedNode(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval) @@ -1460,7 +1503,9 @@ func TestSystemSched_QueuedAllocsMultTG(t *testing.T) { TriggeredBy: structs.EvalTriggerNodeUpdate, JobID: job.ID, NodeID: node.ID, + Status: structs.EvalStatusPending, } + noErr(t, h.State.UpsertEvals(h.NextIndex(), []*structs.Evaluation{eval})) // Process the evaluation err := h.Process(NewSystemScheduler, eval)