Skip to content

Commit

Permalink
Use t.Setenv
Browse files Browse the repository at this point in the history
Co-authored-by: rosstimothy <[email protected]>
  • Loading branch information
codingllama and rosstimothy committed Oct 18, 2024
1 parent 8e8177f commit fe06391
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/devicetrust/enroll/auto_enroll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package enroll_test

import (
"context"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -70,11 +69,7 @@ func TestAutoEnrollCeremony_Run(t *testing.T) {
}

func TestAutoEnroll_disabledByEnv(t *testing.T) {
// 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) })
t.Setenv("TELEPORT_DEVICE_AUTO_ENROLL_DISABLED", "1")

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

0 comments on commit fe06391

Please sign in to comment.