Fix flaky audit test (#2093)
* Show full unexpected error when assertion fails * restart jenkins * restart jenkins * restart jenkins * restart jenkins * Even better display of the unexpected error * Fix flakiness using kaloyan-raev/errs fork * Add more logs * restart jenkins * restart jenkins * Better print for unexpected errors * "error" instead of "err" * restart jenkins * Switch to zeebo/errs v1.2.0 * restart jenkins * restart jenkins * restart jenkins * restart jenkins * restart jenkins * restart jenkins * Remove some extra logs * restart jenkins
This commit is contained in:
parent
cc47bf2df7
commit
099cf921d3
2
go.mod
2
go.mod
@ -103,7 +103,7 @@ require (
|
|||||||
github.com/vivint/infectious v0.0.0-20190108171102-2455b059135b
|
github.com/vivint/infectious v0.0.0-20190108171102-2455b059135b
|
||||||
github.com/yuin/gopher-lua v0.0.0-20180918061612-799fa34954fb // indirect
|
github.com/yuin/gopher-lua v0.0.0-20180918061612-799fa34954fb // indirect
|
||||||
github.com/zeebo/admission v0.0.0-20180821192747-f24f2a94a40c
|
github.com/zeebo/admission v0.0.0-20180821192747-f24f2a94a40c
|
||||||
github.com/zeebo/errs v1.1.1
|
github.com/zeebo/errs v1.2.0
|
||||||
github.com/zeebo/float16 v0.1.0 // indirect
|
github.com/zeebo/float16 v0.1.0 // indirect
|
||||||
github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54 // indirect
|
github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54 // indirect
|
||||||
github.com/zeebo/structs v1.0.1
|
github.com/zeebo/structs v1.0.1
|
||||||
|
2
go.sum
2
go.sum
@ -377,6 +377,8 @@ github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6 h1:bs7mSHVrLRQHxqWcm0
|
|||||||
github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
|
github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
|
||||||
github.com/zeebo/errs v1.1.1 h1:Cs5Noqj/tj3Ql/hLkD9WdumKlssx/IN2zr7CRGNOKZA=
|
github.com/zeebo/errs v1.1.1 h1:Cs5Noqj/tj3Ql/hLkD9WdumKlssx/IN2zr7CRGNOKZA=
|
||||||
github.com/zeebo/errs v1.1.1/go.mod h1:Yj8dHrUQwls1bF3dr/vcSIu+qf4mI7idnTcHfoACc6I=
|
github.com/zeebo/errs v1.1.1/go.mod h1:Yj8dHrUQwls1bF3dr/vcSIu+qf4mI7idnTcHfoACc6I=
|
||||||
|
github.com/zeebo/errs v1.2.0 h1:Tk8UszIOLEjtx6DWnvfmMJe6N8q7vu03Bj95HMWDUkc=
|
||||||
|
github.com/zeebo/errs v1.2.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
||||||
github.com/zeebo/float16 v0.1.0 h1:kRqxv5og6z1emEyz5FpW0/BVHe5VfxEAw6b1ljCZlUc=
|
github.com/zeebo/float16 v0.1.0 h1:kRqxv5og6z1emEyz5FpW0/BVHe5VfxEAw6b1ljCZlUc=
|
||||||
github.com/zeebo/float16 v0.1.0/go.mod h1:fssGvvXu+XS8MH57cKmyrLB/cqioYeYX/2mXCN3a5wo=
|
github.com/zeebo/float16 v0.1.0/go.mod h1:fssGvvXu+XS8MH57cKmyrLB/cqioYeYX/2mXCN3a5wo=
|
||||||
github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54 h1:+cwNE5KJ3pika4HuzmDHkDlK5myo0G9Sv+eO7WWxnUQ=
|
github.com/zeebo/incenc v0.0.0-20180505221441-0d92902eec54 h1:+cwNE5KJ3pika4HuzmDHkDlK5myo0G9Sv+eO7WWxnUQ=
|
||||||
|
@ -132,9 +132,13 @@ func TestDownloadSharesOfflineNode(t *testing.T) {
|
|||||||
|
|
||||||
for i, share := range shares {
|
for i, share := range shares {
|
||||||
if nodes[i] == stoppedNodeID {
|
if nodes[i] == stoppedNodeID {
|
||||||
assert.True(t, transport.Error.Has(share.Error))
|
assert.True(t, transport.Error.Has(share.Error), "unexpected error: %+v", share.Error)
|
||||||
assert.NotEqual(t, context.DeadlineExceeded, errs.Unwrap(share.Error))
|
assert.False(t, errs.IsFunc(share.Error, func(err error) bool {
|
||||||
assert.Equal(t, codes.Unknown, status.Code(errs.Unwrap(share.Error)))
|
return err == context.DeadlineExceeded
|
||||||
|
}), "unexpected error: %+v", share.Error)
|
||||||
|
assert.True(t, errs.IsFunc(share.Error, func(err error) bool {
|
||||||
|
return status.Code(err) == codes.Unknown
|
||||||
|
}), "unexpected error: %+v", share.Error)
|
||||||
} else {
|
} else {
|
||||||
assert.NoError(t, share.Error)
|
assert.NoError(t, share.Error)
|
||||||
}
|
}
|
||||||
@ -193,7 +197,9 @@ func TestDownloadSharesMissingPiece(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, share := range shares {
|
for _, share := range shares {
|
||||||
assert.Equal(t, codes.NotFound, status.Code(errs.Unwrap(share.Error)))
|
assert.True(t, errs.IsFunc(share.Error, func(err error) bool {
|
||||||
|
return status.Code(err) == codes.NotFound
|
||||||
|
}), "unexpected error: %+v", share.Error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -268,8 +274,10 @@ func TestDownloadSharesDialTimeout(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, share := range shares {
|
for _, share := range shares {
|
||||||
assert.True(t, transport.Error.Has(share.Error))
|
assert.True(t, transport.Error.Has(share.Error), "unexpected error: %+v", share.Error)
|
||||||
assert.Equal(t, context.DeadlineExceeded, errs.Unwrap(share.Error))
|
assert.True(t, errs.IsFunc(share.Error, func(err error) bool {
|
||||||
|
return err == context.DeadlineExceeded
|
||||||
|
}), "unexpected error: %+v", share.Error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -346,8 +354,10 @@ func TestDownloadSharesDownloadTimeout(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
for _, share := range shares {
|
for _, share := range shares {
|
||||||
assert.Equal(t, codes.DeadlineExceeded, status.Code(errs.Unwrap(share.Error)))
|
assert.True(t, errs.IsFunc(share.Error, func(err error) bool {
|
||||||
assert.False(t, transport.Error.Has(share.Error))
|
return status.Code(err) == codes.DeadlineExceeded
|
||||||
|
}), "unexpected error: %+v", share.Error)
|
||||||
|
assert.False(t, transport.Error.Has(share.Error), "unexpected error: %+v", share.Error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user