mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-01 22:15:51 +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> |
||
---|---|---|
.. | ||
conffile | ||
ipnauth | ||
ipnlocal | ||
ipnserver | ||
ipnstate | ||
localapi | ||
policy | ||
store | ||
backend.go | ||
conf.go | ||
doc.go | ||
ipn_clone.go | ||
ipn_test.go | ||
ipn_view.go | ||
prefs_test.go | ||
prefs.go | ||
serve_test.go | ||
serve.go | ||
store_test.go | ||
store.go |