diff --git a/kubernetes/provider_test.go b/kubernetes/provider_test.go index d721832281..5448e5a1eb 100644 --- a/kubernetes/provider_test.go +++ b/kubernetes/provider_test.go @@ -481,7 +481,7 @@ var testAccProviderFactoriesInternal = map[string]func() (*schema.Provider, erro }, } -func TestAccKubernetesProvider_config_path(t *testing.T) { +func TestAccKubernetesProviderConfig_config_path(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckInternal(t) }, @@ -559,7 +559,7 @@ func TestAccKubernetesProvider_config_path(t *testing.T) { }) } -func TestAccKubernetesProvider_config_paths(t *testing.T) { +func TestAccKubernetesProviderConfig_config_paths(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckInternal(t) }, ProviderFactories: testAccProviderFactoriesInternal, @@ -600,7 +600,7 @@ func TestAccKubernetesProvider_config_paths(t *testing.T) { }) } -func TestAccKubernetesProvider_config_paths_env(t *testing.T) { +func TestAccKubernetesProviderConfig_config_paths_env(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { @@ -627,7 +627,7 @@ func TestAccKubernetesProvider_config_paths_env(t *testing.T) { }) } -func TestAccKubernetesProvider_config_paths_env_wantError(t *testing.T) { +func TestAccKubernetesProviderConfig_config_paths_env_wantError(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckInternal_setEnv(t, map[string]string{ @@ -650,22 +650,22 @@ func TestAccKubernetesProvider_config_paths_env_wantError(t *testing.T) { }) } -func TestAccKubernetesProvider_config_paths_host_env_wantError(t *testing.T) { +func TestAccKubernetesProviderConfig_host_env_wantError(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckInternal_setEnv(t, map[string]string{ + "KUBE_HOST": "test-host", "KUBE_CONFIG_PATHS": strings.Join([]string{ "./testdata/kubeconfig", "./testdata/kubeconfig", }, string(os.PathListSeparator)), - "KUBE_HOST": "test-host", }) }, ProviderFactories: testAccProviderFactoriesInternal, Steps: []resource.TestStep{ { Config: testAccKubernetesProviderConfig("# empty"), - ExpectError: regexp.MustCompile(`"config_paths": conflicts with host`), + ExpectError: regexp.MustCompile(`"host": conflicts with config_paths`), PlanOnly: true, ExpectNonEmptyPlan: true, }, @@ -673,7 +673,7 @@ func TestAccKubernetesProvider_config_paths_host_env_wantError(t *testing.T) { }) } -func TestAccKubernetesProvider_host(t *testing.T) { +func TestAccKubernetesProviderConfig_host(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheckInternal(t) }, ProviderFactories: testAccProviderFactoriesInternal, @@ -723,13 +723,22 @@ func TestAccKubernetesProvider_host(t *testing.T) { { Config: testAccKubernetesProviderConfig( providerConfig_exec("test-exec") + - providerConfig_token("test-token"), + providerConfig_cluster_ca_certificate("test-ca-cert"), ), PlanOnly: true, ExpectNonEmptyPlan: true, // Error: "exec": all of `cluster_ca_certificate,exec,host` must be specified ExpectError: regexp.MustCompile("cluster_ca_certificate,exec,host"), }, + { + Config: testAccKubernetesProviderConfig( + providerConfig_exec("test-exec") + + providerConfig_host("https://test-host") + + providerConfig_cluster_ca_certificate("test-ca-cert"), + ), + PlanOnly: true, + ExpectNonEmptyPlan: true, + }, { Config: testAccKubernetesProviderConfig( providerConfig_token("test-token"), @@ -765,6 +774,17 @@ func TestAccKubernetesProvider_host(t *testing.T) { PlanOnly: true, ExpectNonEmptyPlan: true, }, + { + Config: testAccKubernetesProviderConfig( + providerConfig_host("https://test-host") + + providerConfig_cluster_ca_certificate("test-ca-cert") + + providerConfig_client_cert("test-client-cert"), + ), + PlanOnly: true, + ExpectNonEmptyPlan: true, + // Error: "client_certificate": all of `client_certificate,client_key,cluster_ca_certificate,host` must be specified + ExpectError: regexp.MustCompile("client_certificate,client_key,cluster_ca_certificate,host"), + }, }, }) }