mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Implement Unwrap to errors
Signed-off-by: Kostadin Plachkov <k.n.plachkov@gmail.com>
This commit is contained in:
@@ -22,6 +22,9 @@ func TestNotFound(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected not found error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConflict(t *testing.T) {
|
||||
@@ -35,6 +38,9 @@ func TestConflict(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected conflict error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestForbidden(t *testing.T) {
|
||||
@@ -48,6 +54,9 @@ func TestForbidden(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected forbidden error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidParameter(t *testing.T) {
|
||||
@@ -61,6 +70,9 @@ func TestInvalidParameter(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected invalid argument error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotImplemented(t *testing.T) {
|
||||
@@ -74,6 +86,9 @@ func TestNotImplemented(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected not implemented error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotModified(t *testing.T) {
|
||||
@@ -87,6 +102,9 @@ func TestNotModified(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected not modified error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnauthorized(t *testing.T) {
|
||||
@@ -100,6 +118,9 @@ func TestUnauthorized(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected unauthorized error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnknown(t *testing.T) {
|
||||
@@ -113,6 +134,9 @@ func TestUnknown(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected unknown error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancelled(t *testing.T) {
|
||||
@@ -126,6 +150,9 @@ func TestCancelled(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected cancelled error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeadline(t *testing.T) {
|
||||
@@ -139,6 +166,9 @@ func TestDeadline(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected deadline error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDataLoss(t *testing.T) {
|
||||
@@ -152,6 +182,9 @@ func TestDataLoss(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected data loss error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnavailable(t *testing.T) {
|
||||
@@ -165,6 +198,9 @@ func TestUnavailable(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected unavaillable error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSystem(t *testing.T) {
|
||||
@@ -178,4 +214,7 @@ func TestSystem(t *testing.T) {
|
||||
if cause := e.(causal).Cause(); cause != errTest {
|
||||
t.Fatalf("causual should be errTest, got: %v", cause)
|
||||
}
|
||||
if !errors.Is(e, errTest) {
|
||||
t.Fatalf("expected system error to match errTest")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user