2020-09-16 14:19:51 +00:00
|
|
|
// Copyright 2020 the Pinniped contributors. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2020-08-03 14:17:11 +00:00
|
|
|
|
|
|
|
package library
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2020-08-25 01:07:34 +00:00
|
|
|
// GetEnv gets the environment variable with key and asserts that it is not
|
2020-08-03 14:17:11 +00:00
|
|
|
// empty. It returns the value of the environment variable.
|
2020-08-25 01:07:34 +00:00
|
|
|
func GetEnv(t *testing.T, key string) string {
|
2020-08-03 14:17:11 +00:00
|
|
|
t.Helper()
|
|
|
|
value := os.Getenv(key)
|
|
|
|
require.NotEmptyf(t, value, "must specify %s env var for integration tests", key)
|
|
|
|
return value
|
|
|
|
}
|