structs_test use testify require.True instead of t.Fatal
This commit is contained in:
parent
8aa97cff13
commit
19ba0f4882
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue