summaryrefslogtreecommitdiffhomepage
path: root/ipn/ipnlocal/netmapcache/netmapcache_test.go
AgeCommit message (Collapse)AuthorFilesLines
2026-03-06all: use Go 1.26 things, run most gofix modernizersBrad Fitzpatrick1-1/+1
I omitted a lot of the min/max modernizers because they didn't result in more clear code. Some of it's older "for x := range 123". Also: errors.AsType, any, fmt.Appendf, etc. Updates #18682 Change-Id: I83a451577f33877f962766a5b65ce86f7696471c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-02-13ipn/ipnlocal/netmapcache: include packet filters in the cache (#18715)M. J. Fromberger1-4/+51
Store packet filter rules in the cache. The match expressions are derived from the filter rules, so these do not need to be stored explicitly, but ensure they are properly reconstructed when the cache is read back. Update the tests to include these fields, and provide representative values. Updates #12639 Change-Id: I9bdb972a86d2c6387177d393ada1f54805a2448b Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2026-02-03ipn/ipnlocal/netmapcache: ensure cache updates preserve unchanged data (#18590)M. J. Fromberger1-0/+19
Found by @cmol. When rewriting the same value into the cache, we were dropping the unchanged keys, resulting in the cache being pruned incorrectly. Also update the tests to catch this. Updates #12639 Change-Id: Iab67e444eb7ddc22ccc680baa2f6a741a00eb325 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2026-01-28ipn/ipnlocal/netmapcache: report the correct error for a missing column (#18547)M. J. Fromberger1-5/+59
The file-based cache implementation was not reporting the correct error when attempting to load a missing column key. Make it do so, and update the tests to cover that case. Updates #12639 Change-Id: Ie2c45a0a7e528d4125f857859c92df807116a56e Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2026-01-26ipn/ipnlocal/netmapcache: add a package to split and cache network maps (#18497)M. J. Fromberger1-0/+298
This commit is based on part of #17925, reworked as a separate package. Add a package that can store and load netmap.NetworkMap values in persistent storage, using a basic columnar representation. This commit includes a default storage interface based on plain files, but the interface can be implemented with more structured storage if we want to later. The tests are set up to require that all the fields of the NetworkMap are handled, except those explicitly designated as not-cached, and check that a fully-populated value can round-trip correctly through the cache. Adding or removing fields, either in the NetworkMap or in the cached representation, will trigger either build failures (e.g., for type mismatch) or test failures (e.g., for representation changes or missing fields). This isn't quite as nice as automatically updating the representation, which I also prototyped, but is much simpler to maintain and less code. This commit does not yet hook up the cache to the backend, that will be a subsequent change. Updates #12639 Change-Id: Icb48639e1d61f2aec59904ecd172c73e05ba7bf9 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>