From 592fec760675802937115ec5da08da935b093934 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 10 Mar 2020 11:57:14 -0700 Subject: [PATCH] wgengine/magicsock: move device close to uncursed portion of test. Device close used to suffer from deadlocks, but no longer. Signed-off-by: David Anderson --- wgengine/magicsock/magicsock_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 92f19068d..7df6d7a45 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -389,6 +389,7 @@ func TestTwoDevicePing(t *testing.T) { if err := dev1.Reconfig(&cfgs[0]); err != nil { t.Fatal(err) } + defer dev1.Close() tun2 := tuntest.NewChannelTUN() dev2 := device.NewDevice(tun2.TUN(), &device.DeviceOptions{ @@ -398,6 +399,7 @@ func TestTwoDevicePing(t *testing.T) { SkipBindUpdate: true, }) dev2.Up() + defer dev2.Close() if err := dev2.Reconfig(&cfgs[1]); err != nil { t.Fatal(err) @@ -460,8 +462,6 @@ func TestTwoDevicePing(t *testing.T) { if os.Getenv("RUN_CURSED_TESTS") == "" { t.Skip("test is very broken, don't run in CI until it's reliable.") } - defer dev1.Close() // TODO(crawshaw): this hangs - defer dev2.Close() // TODO(crawshaw): this hangs pingSeq := func(t *testing.T, count int, totalTime time.Duration, strict bool) { msg := func(i int) []byte {