mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
3bf2bddbb5
In order to test the sticky last suggestion code, a test was written for LocalBackend.SuggestExitNode but it contains a random number generator which makes writing comprehensive tests very difficult. This doesn't change how the last suggestion works, but it adds some infrastructure to make that easier in a later PR. This adds func parameters for the two randomized parts: breaking ties between DERP regions and breaking ties between nodes. This way tests can validate the entire list of tied options, rather than expecting a particular outcome given a particular random seed. As a result of this, the global random number generator can be used rather than seeding a local one each time. In order to see the tied nodes for the location based (i.e. Mullvad) case, pickWeighted needed to return a slice instead of a single arbitrary option, so there is a small change in how that works. Updates tailscale/corp#19681 Change-Id: I83c48a752abdec0f59c58ccfd8bfb3f3f17d0ea8 Signed-off-by: Adrian Dewhurst <adrian@tailscale.com> |
||
---|---|---|
.. | ||
testdata | ||
breaktcp_darwin.go | ||
breaktcp_linux.go | ||
c2n_pprof.go | ||
c2n_test.go | ||
c2n.go | ||
cert_js.go | ||
cert_test.go | ||
cert.go | ||
dnsconfig_test.go | ||
drive.go | ||
expiry_test.go | ||
expiry.go | ||
local_test.go | ||
local.go | ||
loglines_test.go | ||
network-lock_test.go | ||
network-lock.go | ||
peerapi_h2c.go | ||
peerapi_macios_ext.go | ||
peerapi_test.go | ||
peerapi.go | ||
profiles_notwindows.go | ||
profiles_test.go | ||
profiles_windows.go | ||
profiles.go | ||
serve_test.go | ||
serve.go | ||
ssh_stub.go | ||
ssh_test.go | ||
ssh.go | ||
state_test.go | ||
taildrop.go | ||
web_client_stub.go | ||
web_client.go |