From 9bfed7893ae2f313001feef88877fac085fce4a1 Mon Sep 17 00:00:00 2001 From: Abirdcfly Date: Mon, 8 Aug 2022 17:26:08 +0800 Subject: [PATCH] fix minor unreachable code caused by t.Fatal Signed-off-by: Abirdcfly --- nomad/structs/structs_test.go | 2 -- scheduler/feasible_test.go | 3 +-- scheduler/generic_sched_test.go | 6 ++++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/nomad/structs/structs_test.go b/nomad/structs/structs_test.go index 02d0fe1be37..71429d759f6 100644 --- a/nomad/structs/structs_test.go +++ b/nomad/structs/structs_test.go @@ -4321,7 +4321,6 @@ func TestTaskArtifact_Validate_Checksum(t *testing.T) { err := tc.Input.Validate() if (err != nil) != tc.Err { t.Fatalf("case %d: %v", i, err) - continue } } } @@ -6669,7 +6668,6 @@ func TestNodeReservedNetworkResources_ParseReserved(t *testing.T) { out, err := r.ParseReservedHostPorts() if (err != nil) != tc.Err { t.Fatalf("test case %d: %v", i, err) - continue } require.Equal(out, tc.Parsed) diff --git a/scheduler/feasible_test.go b/scheduler/feasible_test.go index 16a0ada00a7..2a5d804a210 100644 --- a/scheduler/feasible_test.go +++ b/scheduler/feasible_test.go @@ -34,8 +34,7 @@ func TestStaticIterator_Reset(t *testing.T) { out := collectFeasible(static) if len(out) != len(nodes) { - t.Fatalf("out: %#v", out) - t.Fatalf("missing nodes %d %#v", i, static) + t.Fatalf("out: %#v missing nodes %d %#v", out, i, static) } ids := make(map[string]struct{}) diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index 7b47768a4ee..000e133d255 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -64,10 +64,11 @@ func TestServiceSched_JobRegister(t *testing.T) { // Ensure the eval has no spawned blocked eval if len(h.CreateEvals) != 0 { - t.Fatalf("bad: %#v", h.CreateEvals) + t.Errorf("bad: %#v", h.CreateEvals) if h.Evals[0].BlockedEval != "" { t.Fatalf("bad: %#v", h.Evals[0]) } + t.FailNow() } // Ensure the plan allocated @@ -1517,10 +1518,11 @@ func TestServiceSched_EvaluateBlockedEval_Finished(t *testing.T) { // Ensure the eval has no spawned blocked eval if len(h.Evals) != 1 { - t.Fatalf("bad: %#v", h.Evals) + t.Errorf("bad: %#v", h.Evals) if h.Evals[0].BlockedEval != "" { t.Fatalf("bad: %#v", h.Evals[0]) } + t.FailNow() } // Ensure the plan allocated