storage/kubernetes: don't guess the kubeconfig location and change test env
Using the default KUBECONFIG environment variable to indicate that the Kubernetes tests should be run lead to cases where developers accidentally ran the tests. This has now been changed to "DEX_KUBECONFIG" and documentation hsa been added detailing how to run these tests. Additionally, no other storage reads environment variables for its normal configuration (outside of tests) so the Kubernetes storage no longer does. Overall, be less surprising.
This commit is contained in:
@@ -8,15 +8,19 @@ import (
|
||||
"github.com/coreos/dex/storage/conformance"
|
||||
)
|
||||
|
||||
const testKubeConfigEnv = "DEX_KUBECONFIG"
|
||||
|
||||
func TestLoadClient(t *testing.T) {
|
||||
loadClient(t)
|
||||
}
|
||||
|
||||
func loadClient(t *testing.T) *client {
|
||||
if os.Getenv("KUBECONFIG") == "" {
|
||||
t.Skip()
|
||||
config := Config{
|
||||
KubeConfigFile: os.Getenv(testKubeConfigEnv),
|
||||
}
|
||||
if config.KubeConfigFile == "" {
|
||||
t.Skipf("test environment variable %q not set, skipping", testKubeConfigEnv)
|
||||
}
|
||||
var config Config
|
||||
s, err := config.open()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Reference in New Issue
Block a user