From 19ba0f488211bd2cdea1b07e59eabb44645e1900 Mon Sep 17 00:00:00 2001 From: Lang Martin Date: Tue, 23 Apr 2019 17:00:11 -0400 Subject: [PATCH] structs_test use testify require.True instead of t.Fatal --- nomad/structs/structs_test.go | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/nomad/structs/structs_test.go b/nomad/structs/structs_test.go index 0131c491a..ddae07661 100644 --- a/nomad/structs/structs_test.go +++ b/nomad/structs/structs_test.go @@ -620,57 +620,47 @@ func TestJob_RequiredSignals(t *testing.T) { // test new Equal comparisons for components of Jobs func TestJob_PartEqual(t *testing.T) { ns := &Networks{} - if !ns.Equals(&Networks{}) { - t.Fatal("network set wise not equal") - } + require.True(t, ns.Equals(&Networks{})) ns = &Networks{ &NetworkResource{Device: "eth0"}, } - if !ns.Equals(&Networks{ + require.True(t, ns.Equals(&Networks{ &NetworkResource{Device: "eth0"}, - }) { - t.Fatal("network set wise not equal") - } + })) ns = &Networks{ &NetworkResource{Device: "eth0"}, &NetworkResource{Device: "eth1"}, &NetworkResource{Device: "eth2"}, } - if !ns.Equals(&Networks{ + require.True(t, ns.Equals(&Networks{ &NetworkResource{Device: "eth2"}, &NetworkResource{Device: "eth0"}, &NetworkResource{Device: "eth1"}, - }) { - t.Fatal("network set wise not equal") - } + })) cs := &Constraints{ &Constraint{"left0", "right0", "=", ""}, &Constraint{"left1", "right1", "=", ""}, &Constraint{"left2", "right2", "=", ""}, } - if !cs.Equals(&Constraints{ + require.True(t, cs.Equals(&Constraints{ &Constraint{"left0", "right0", "=", ""}, &Constraint{"left2", "right2", "=", ""}, &Constraint{"left1", "right1", "=", ""}, - }) { - t.Fatal("constraint set wise not equal") - } + })) as := &Affinities{ &Affinity{"left0", "right0", "=", 0, ""}, &Affinity{"left1", "right1", "=", 0, ""}, &Affinity{"left2", "right2", "=", 0, ""}, } - if !as.Equals(&Affinities{ + require.True(t, as.Equals(&Affinities{ &Affinity{"left0", "right0", "=", 0, ""}, &Affinity{"left2", "right2", "=", 0, ""}, &Affinity{"left1", "right1", "=", 0, ""}, - }) { - t.Fatal("affinity set wise not equal") - } + })) } func TestTaskGroup_Validate(t *testing.T) {