Skip to content

Commit

Permalink
test(memlimit): rollback environment variable after testing
Browse files Browse the repository at this point in the history
  • Loading branch information
KimMachineGun committed Jan 9, 2024
1 parent ab8c940 commit e243cf4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions memlimit/experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ func TestParseExperiments(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
exp, ok := os.LookupEnv(envAUTOMEMLIMIT_EXPERIMENT)
t.Cleanup(func() {
if ok {
os.Setenv(envAUTOMEMLIMIT_EXPERIMENT, exp)
} else {
os.Unsetenv(envAUTOMEMLIMIT_EXPERIMENT)
}
})

os.Setenv("AUTOMEMLIMIT_EXPERIMENT", tt.env)
exps, err := parseExperiments()
if !reflect.DeepEqual(exps, tt.want) {
Expand Down

0 comments on commit e243cf4

Please sign in to comment.