- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for SetEnvForTest (0.25 sec)
-
pkg/test/util.go
func SetForTest[T any](t Failer, vv *T, v T) { old := *vv *vv = v t.Cleanup(func() { *vv = old }) } // SetEnvForTest sets an environment variable for the duration of a test, then resets it once the test is complete. func SetEnvForTest(t Failer, k, v string) { old, oldset := os.LookupEnv(k) if err := os.Setenv(k, v); err != nil { t.Fatal(err) } t.Cleanup(func() { if oldset {
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Fri Jan 05 01:20:59 UTC 2024 - 1.9K bytes - Viewed (0) -
pkg/flag/flag_test.go
"istio.io/istio/pkg/test/util/assert" ) func TestBind(t *testing.T) { type Options struct { A, B, C string Env string Bool bool } opts := Options{ B: "b-def", } test.SetEnvForTest(t, "TEST_ENV", "from-env") fs := pflag.NewFlagSet("test", pflag.ContinueOnError) Bind(fs, "a", "", "desc", &opts.A) Bind(fs, "bool", "", "desc", &opts.Bool) BindEnv(fs, "test-env", "", "desc", &opts.Env)
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed Nov 01 04:37:36 UTC 2023 - 1.2K bytes - Viewed (0) -
pkg/kube/inject/inject_test.go
setup: func(t test.Failer) { test.SetEnvForTest(t, features.EnableNativeSidecars.Name, "true") }, }, { in: "gateway.yaml", want: "gateway.yaml.injected", }, { in: "gateway.yaml", want: "gateway.yaml.injected", setup: func(t test.Failer) { test.SetEnvForTest(t, features.EnableNativeSidecars.Name, "true") }, }, {
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Fri May 31 20:35:11 UTC 2024 - 34.1K bytes - Viewed (0)