|
Ran
|
Jobs
1
|
Files
646
|
Run time
1min
|
Badge
README BADGES
|
push
github
ipn/ipnlocal: improve testability of random node selection 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: I83c48a752 Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
19 of 24 new or added lines in 1 file covered. (79.17%)
47459 of 93002 relevant lines covered (51.03%)
0.57 hits per line
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 9357177100.1 | 0 |
51.03 |
GitHub Action Run |