mirror of
https://github.com/moby/moby.git
synced 2026-08-08 17:11:38 +00:00
libnetwork: TestUserChain: use assert.Check and is.ErrorContains
Don't fail early if we can still test more, and be slightly more strict in what error we're looking for. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -69,9 +69,9 @@ func TestUserChain(t *testing.T) {
|
||||
|
||||
if tc.insert {
|
||||
_, err = iptable4.Raw("-A", fwdChainName, "-j", "DROP")
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, err)
|
||||
_, err = iptable6.Raw("-A", fwdChainName, "-j", "DROP")
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, err)
|
||||
}
|
||||
arrangeUserFilterRule()
|
||||
|
||||
@@ -81,10 +81,10 @@ func TestUserChain(t *testing.T) {
|
||||
assert.Check(t, is.DeepEqual(getRules(t, iptable4, usrChainName), tc.userChain))
|
||||
assert.Check(t, is.DeepEqual(getRules(t, iptable6, usrChainName), tc.userChain))
|
||||
} else {
|
||||
_, err := iptable4.Raw("-S", usrChainName)
|
||||
assert.Assert(t, err != nil, "ipv4 chain %v: created unexpectedly", usrChainName)
|
||||
_, err = iptable4.Raw("-S", usrChainName)
|
||||
assert.Check(t, is.ErrorContains(err, "No chain/target/match by that name"), "ipv4 chain %v: created unexpectedly", usrChainName)
|
||||
_, err = iptable6.Raw("-S", usrChainName)
|
||||
assert.Assert(t, err != nil, "ipv6 chain %v: created unexpectedly", usrChainName)
|
||||
assert.Check(t, is.ErrorContains(err, "No chain/target/match by that name"), "ipv6 chain %v: created unexpectedly", usrChainName)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user