routing+discovery: uniform error codes in routing

This commit is contained in:
yyforyongyu
2021-12-13 08:25:34 +08:00
parent c15c8a1f0b
commit dd74486b59
5 changed files with 45 additions and 32 deletions

View File

@@ -141,14 +141,18 @@ func TestValidationBarrierQuit(t *testing.T) {
switch {
// First half should return without failure.
case i < numTasks/4 && err != routing.ErrParentValidationFailed:
case i < numTasks/4 && !routing.IsError(
err, routing.ErrParentValidationFailed,
):
t.Fatalf("unexpected failure while waiting: %v", err)
case i >= numTasks/4 && i < numTasks/2 && err != nil:
t.Fatalf("unexpected failure while waiting: %v", err)
// Last half should return the shutdown error.
case i >= numTasks/2 && err != routing.ErrVBarrierShuttingDown:
case i >= numTasks/2 && !routing.IsError(
err, routing.ErrVBarrierShuttingDown,
):
t.Fatalf("expected failure after quitting: want %v, "+
"got %v", routing.ErrVBarrierShuttingDown, err)
}