aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2026-01-08 10:25:44 +0100
committerQuim Muntal <quimmuntal@gmail.com>2026-01-12 11:53:00 -0800
commit5741608de26f06488e771fd7b3b35ca2ca4c93a6 (patch)
tree146f444181ef06776d52589bd45bf23c4b647577 /src/net
parentdf6c351aa4bbc8805406bfef979e62f59fc76da9 (diff)
downloadgo-5741608de26f06488e771fd7b3b35ca2ca4c93a6.tar.xz
net: don't ignore errors in TestUnixUnlink
TestUnixUnlink calls some functions and methods that can fail, but it ignores the returned errors. This test is flaky on Windows, and those errors should be checked to help diagnose the problem. Updates #75282 Updates #76582 Updates #77038 Change-Id: Ia868762a4c0b94a7255d57add63777568caa6cd2 Reviewed-on: https://go-review.googlesource.com/c/go/+/734720 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/unixsock_test.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go
index f6c5679f42..3e4a14b255 100644
--- a/src/net/unixsock_test.go
+++ b/src/net/unixsock_test.go
@@ -375,6 +375,17 @@ func TestUnixUnlink(t *testing.T) {
}
return l.(*UnixListener)
}
+ fileListener := func(t *testing.T, l *UnixListener) (*os.File, Listener) {
+ f, err := l.File()
+ if err != nil {
+ t.Fatal(err)
+ }
+ ln, err := FileListener(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return f, ln
+ }
checkExists := func(t *testing.T, desc string) {
if _, err := os.Stat(name); err != nil {
t.Fatalf("unix socket does not exist %s: %v", desc, err)
@@ -397,8 +408,7 @@ func TestUnixUnlink(t *testing.T) {
// FileListener should not.
t.Run("FileListener", func(t *testing.T) {
l := listen(t)
- f, _ := l.File()
- l1, _ := FileListener(f)
+ f, l1 := fileListener(t, l)
checkExists(t, "after FileListener")
f.Close()
checkExists(t, "after File close")
@@ -444,8 +454,7 @@ func TestUnixUnlink(t *testing.T) {
t.Run("FileListener/SetUnlinkOnClose(true)", func(t *testing.T) {
l := listen(t)
- f, _ := l.File()
- l1, _ := FileListener(f)
+ f, l1 := fileListener(t, l)
checkExists(t, "after FileListener")
l1.(*UnixListener).SetUnlinkOnClose(true)
f.Close()
@@ -457,8 +466,7 @@ func TestUnixUnlink(t *testing.T) {
t.Run("FileListener/SetUnlinkOnClose(false)", func(t *testing.T) {
l := listen(t)
- f, _ := l.File()
- l1, _ := FileListener(f)
+ f, l1 := fileListener(t, l)
checkExists(t, "after FileListener")
l1.(*UnixListener).SetUnlinkOnClose(false)
f.Close()