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 <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-03-10 11:57:14 -07:00
parent a265d7cbff
commit 592fec7606
1 changed files with 2 additions and 2 deletions

View File

@ -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 {