mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
net/netcheck: add addReportHistoryAndSetPreferredDERP() test case (#13989)
Add an explicit case for exercising preferred DERP hysteresis around the branch that compares latencies on a percentage basis. Updates #cleanup Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
parent
84c8860472
commit
49de23cf1b
@ -357,6 +357,15 @@ type step struct {
|
|||||||
wantPrevLen: 3,
|
wantPrevLen: 3,
|
||||||
wantDERP: 2, // moved to d2 since d1 is gone
|
wantDERP: 2, // moved to d2 since d1 is gone
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "preferred_derp_hysteresis_no_switch_pct",
|
||||||
|
steps: []step{
|
||||||
|
{0 * time.Second, report("d1", 34*time.Millisecond, "d2", 35*time.Millisecond)},
|
||||||
|
{1 * time.Second, report("d1", 34*time.Millisecond, "d2", 23*time.Millisecond)},
|
||||||
|
},
|
||||||
|
wantPrevLen: 2,
|
||||||
|
wantDERP: 1, // diff is 11ms, but d2 is greater than 2/3s of d1
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user