Files
actions-runner-controller/testing/getenv.go
T

20 lines
248 B
Go
Raw Normal View History

2021-06-29 17:52:43 +09:00
package testing
import (
"os"
"testing"
)
func Getenv(t *testing.T, name string, opts ...string) string {
2021-06-29 17:52:43 +09:00
t.Helper()
v := os.Getenv(name)
if v == "" {
if len(opts) == 0 {
t.Fatal(name + " must be set")
}
v = opts[0]
2021-06-29 17:52:43 +09:00
}
return v
}