Update
This commit is contained in:
1 parent
3530afb854
commit
6903fcff27
2146 files changed
+112256
-190703
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package routemanager
|
||||
|
||||
import "tailscale.com/util/testenv"
|
||||
|
||||
// forTest is an unexported type to hide the test-only methods on
|
||||
// [RouteManager] from godoc.
|
||||
type forTest struct{ rm *RouteManager }
|
||||
|
||||
// ForTest returns a handle to test-only methods on rm. The resulting
|
||||
// type is unexported to make it very obvious in godoc that this is
|
||||
// not stable API. This method panics if called outside of tests,
|
||||
// which also centralizes all must-be-in-tests validation.
|
||||
func (rm *RouteManager) ForTest() forTest {
|
||||
testenv.AssertInTest()
|
||||
return forTest{rm}
|
||||
}
|
||||
|
||||
// PeerCount returns the number of peers currently tracked. Callers
|
||||
// must serialize it with mutations like any other write-path access.
|
||||
func (f forTest) PeerCount() int { return len(f.rm.peers) }
|
||||
+1045
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user