Skip to content

Commit

Permalink
Fix TestAutoEnroll_disabledByEnv flakiness (#47723)
Browse files Browse the repository at this point in the history
* Fix TestAutoEnroll_disabledByEnv flakiness

* Use t.Setenv

Co-authored-by: rosstimothy <[email protected]>

---------

Co-authored-by: rosstimothy <[email protected]>
  • Loading branch information
codingllama and rosstimothy committed Oct 18, 2024
1 parent fccabf8 commit f6e0908
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/devicetrust/enroll/auto_enroll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package enroll_test

import (
"context"
"os"
"testing"

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

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

Please sign in to comment.