Files
tailscale/ipn/ipnserver
Alex Chan 80f188f560 envknob: add SetenvForTest helper for safe environment variable handling
Our tests are inconsistent in how they set environment variables and cleanup.
Missing cleanup logic can leak environment variable state across tests and
change the behaviour of subsequent tests.

This recently caused flakes in feature/acme, where `TestGetCertPEMWithValidity`
leaked `TS_CERT_SHARE_MODE` and `TestAsyncRenewalDedup` to fail inconsistently.

To fix the immediate flake and prevent future leaks, introduce a `SetenvForTest`
helper that handles setting and cleaning up environment variables in tests.

Fixes #20902

Change-Id: I9f8ef45ec875d66034cfd0054311bd69b67e2243
Signed-off-by: Alex Chan <alexc@tailscale.com>
(cherry picked from commit 468241a13f)
2026-08-21 12:31:38 +01:00
..
2026-03-05 13:52:01 -08:00