From 0f9e15e2c9d52888cc7c5ab0022b339bfe197e68 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 8 Jun 2016 20:17:10 +0700 Subject: [PATCH] fix h2quic syscall test assertion on windows --- h2quic/server_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/h2quic/server_test.go b/h2quic/server_test.go index 8f72b6104..c18c00f03 100644 --- a/h2quic/server_test.go +++ b/h2quic/server_test.go @@ -4,6 +4,7 @@ import ( "net" "net/http" "os" + "runtime" "sync" "syscall" "time" @@ -315,6 +316,12 @@ var _ = Describe("H2 server", func() { Expect(ok).To(BeTrue()) syscallErr, ok := opErr.Err.(*os.SyscallError) Expect(ok).To(BeTrue()) - Expect(syscallErr.Err).To(MatchError(syscall.EADDRINUSE)) + if runtime.GOOS == "windows" { + // for some reason, Windows return a different error number, corresponding to an WSAEADDRINUSE error + // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms681391(v=vs.85).aspx + Expect(syscallErr.Err).To(Equal(syscall.Errno(0x2740))) + } else { + Expect(syscallErr.Err).To(MatchError(syscall.EADDRINUSE)) + } }) })