summaryrefslogtreecommitdiffhomepage
path: root/device/device_test.go
AgeCommit message (Collapse)Author
2021-01-07device: make test setup more robustJosh Bleecher Snyder
Picking two free ports to use for a test is difficult. The free port we selected might no longer be free when we reach for it a second time. On my machine, this failure mode led to failures approximately once per thousand test runs. Since failures are rare, and threading through and checking for all possible errors is complicated, fix this with a big hammer: Retry if either device fails to come up. Also, if you accidentally pick the same port twice, delightful confusion ensues. The handshake failures manifest as crypto errors, which look scary. Again, fix with retries. To make these retries easier to implement, use testing.T.Cleanup instead of defer to close devices. This requires Go 1.14. Update go.mod accordingly. Go 1.13 is no longer supported anyway. With these fixes, 'go test -race' ran 100,000 times without failure. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-07-31device: get free port when testingSina Siadat
Signed-off-by: Sina Siadat <siadat@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02global: update header comments and modulesJason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-05-02tuntest: split out testing packageDavid Crawshaw
This code is useful to other packages writing tests. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2019-10-16device: test packets between two fake devicesDavid Crawshaw
Signed-off-by: David Crawshaw <crawshaw@tailscale.io>
2019-06-04device: use bytes.Equal for equality check, simplify assertEqualMatt Layher
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-05-29device, tun: rearrange code and fix device testsMatt Layher
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-03-03global: begin modularizationJason A. Donenfeld