Short-circuit TestBackend_PluginMainEnv on plain test run (#5393)

This commit is contained in:
Calvin Leung Huang 2018-09-25 09:22:34 -07:00 committed by GitHub
parent 14ce354353
commit 1aad6e0800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -647,16 +647,17 @@ func TestBackend_PluginMainCredentials(t *testing.T) {
// TestBackend_PluginMainEnv is a mock plugin that simply checks for the existence of FOO env var. // TestBackend_PluginMainEnv is a mock plugin that simply checks for the existence of FOO env var.
func TestBackend_PluginMainEnv(t *testing.T) { func TestBackend_PluginMainEnv(t *testing.T) {
actual := os.Getenv(expectedEnvKey)
if actual != expectedEnvValue {
t.Fatalf("expected: %q, got: %q", expectedEnvValue, actual)
}
args := []string{} args := []string{}
if os.Getenv(pluginutil.PluginUnwrapTokenEnv) == "" && os.Getenv(pluginutil.PluginMetadataModeEnv) != "true" { if os.Getenv(pluginutil.PluginUnwrapTokenEnv) == "" && os.Getenv(pluginutil.PluginMetadataModeEnv) != "true" {
return return
} }
// Check on actual vs expected env var
actual := os.Getenv(expectedEnvKey)
if actual != expectedEnvValue {
t.Fatalf("expected: %q, got: %q", expectedEnvValue, actual)
}
caPEM := os.Getenv(pluginutil.PluginCACertPEMEnv) caPEM := os.Getenv(pluginutil.PluginCACertPEMEnv)
if caPEM == "" { if caPEM == "" {
t.Fatal("CA cert not passed in") t.Fatal("CA cert not passed in")