Skip to content

Commit

Permalink
Fix TestAutoEnroll_disabledByEnv flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
codingllama committed Oct 18, 2024
1 parent 6669f2d commit 8e8177f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/devicetrust/enroll/auto_enroll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ func TestAutoEnrollCeremony_Run(t *testing.T) {
}

func TestAutoEnroll_disabledByEnv(t *testing.T) {
os.Setenv("TELEPORT_DEVICE_AUTO_ENROLL_DISABLED", "1")
// Don't t.Parallel, test changes env variables.

const key = "TELEPORT_DEVICE_AUTO_ENROLL_DISABLED"
os.Setenv(key, "1")
t.Cleanup(func() { os.Unsetenv(key) })

_, err := enroll.AutoEnroll(context.Background(), nil /* devicesClient */)
assert.ErrorIs(t, err, enroll.ErrAutoEnrollDisabled, "AutoEnroll() error mismatch")
Expand Down

0 comments on commit 8e8177f

Please sign in to comment.