Replace errors.Cause() with errors.Is() / errors.As()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2020-04-17 12:01:01 +02:00
parent 45369c61a4
commit 07d60bc257
23 changed files with 50 additions and 45 deletions

View File

@@ -312,7 +312,8 @@ func TestValidateContainerIsolation(t *testing.T) {
func TestFindNetworkErrorType(t *testing.T) {
d := Daemon{}
_, err := d.FindNetwork("fakeNet")
_, ok := errors.Cause(err).(libnetwork.ErrNoSuchNetwork)
var nsn libnetwork.ErrNoSuchNetwork
ok := errors.As(err, &nsn)
if !errdefs.IsNotFound(err) || !ok {
t.Error("The FindNetwork method MUST always return an error that implements the NotFound interface and is ErrNoSuchNetwork")
}