MCPcopy
hub / github.com/tailscale/tailscale / TestStore

Struct TestStore

util/syspolicy/source/test_store.go:82–98  ·  view source on GitHub ↗

TestStore is a [Store] that can be used in tests.

Source from the content-addressed store, hash-verified

80
81// TestStore is a [Store] that can be used in tests.
82type TestStore struct {
83 tb testenv.TB
84
85 done chan struct{}
86
87 storeLock sync.RWMutex // its RLock is exposed via [Store.Lock]/[Store.Unlock].
88 storeLockCount atomic.Int32
89
90 mu sync.RWMutex
91 suspendCount int // change callback are suspended if > 0
92 mr, mw map[pkey.Key]any // maps for reading and writing; they're the same unless the store is suspended.
93 cbs set.HandleSet[func()]
94 closed bool
95
96 readsMu sync.Mutex
97 reads map[testReadOperation]int // how many times a policy setting was read
98}
99
100// NewTestStore returns a new [TestStore].
101// The tb will be used to report coding errors detected by the [TestStore].

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected