Log the error's underyling errno if there is

This test occasionally fails on Windows. This commit logs extra
information about the error to understand the situation better.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato 2022-02-21 21:28:26 +00:00
parent 332f4c9a9b
commit 44dfd7fdbd

View File

@ -25,6 +25,7 @@ import (
"runtime"
"strings"
"sync"
"syscall"
"testing"
"time"
@ -369,6 +370,13 @@ func TestClientEOF(t *testing.T) {
if err := client.Call(ctx, serviceName, "Test", tp, tp); err == nil {
t.Fatalf("expected error when calling against shutdown server")
} else if !errors.Is(err, ErrClosed) {
errno, ok := err.(syscall.Errno)
if ok {
t.Logf("errno=%d", errno)
} else {
t.Logf("error %q doesn't match syscall.Errno", err)
}
t.Fatalf("expected to have a cause of ErrClosed, got %v", err)
}
}