Skip to content

Commit 6dca5d8

Browse files
committed
wip
1 parent 34c0e78 commit 6dca5d8

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

kubernetes/provider_test.go

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ var testAccProviderFactoriesInternal = map[string]func() (*schema.Provider, erro
481481
},
482482
}
483483

484-
func TestAccKubernetesProvider_config_path(t *testing.T) {
484+
func TestAccKubernetesProviderConfig_config_path(t *testing.T) {
485485

486486
resource.Test(t, resource.TestCase{
487487
PreCheck: func() { testAccPreCheckInternal(t) },
@@ -559,7 +559,7 @@ func TestAccKubernetesProvider_config_path(t *testing.T) {
559559
})
560560
}
561561

562-
func TestAccKubernetesProvider_config_paths(t *testing.T) {
562+
func TestAccKubernetesProviderConfig_config_paths(t *testing.T) {
563563
resource.Test(t, resource.TestCase{
564564
PreCheck: func() { testAccPreCheckInternal(t) },
565565
ProviderFactories: testAccProviderFactoriesInternal,
@@ -600,7 +600,7 @@ func TestAccKubernetesProvider_config_paths(t *testing.T) {
600600
})
601601
}
602602

603-
func TestAccKubernetesProvider_config_paths_env(t *testing.T) {
603+
func TestAccKubernetesProviderConfig_config_paths_env(t *testing.T) {
604604

605605
resource.Test(t, resource.TestCase{
606606
PreCheck: func() {
@@ -627,7 +627,7 @@ func TestAccKubernetesProvider_config_paths_env(t *testing.T) {
627627
})
628628
}
629629

630-
func TestAccKubernetesProvider_config_paths_env_wantError(t *testing.T) {
630+
func TestAccKubernetesProviderConfig_config_paths_env_wantError(t *testing.T) {
631631
resource.Test(t, resource.TestCase{
632632
PreCheck: func() {
633633
testAccPreCheckInternal_setEnv(t, map[string]string{
@@ -650,30 +650,30 @@ func TestAccKubernetesProvider_config_paths_env_wantError(t *testing.T) {
650650
})
651651
}
652652

653-
func TestAccKubernetesProvider_config_paths_host_env_wantError(t *testing.T) {
653+
func TestAccKubernetesProviderConfig_host_env_wantError(t *testing.T) {
654654
resource.Test(t, resource.TestCase{
655655
PreCheck: func() {
656656
testAccPreCheckInternal_setEnv(t, map[string]string{
657+
"KUBE_HOST": "test-host",
657658
"KUBE_CONFIG_PATHS": strings.Join([]string{
658659
"./testdata/kubeconfig",
659660
"./testdata/kubeconfig",
660661
}, string(os.PathListSeparator)),
661-
"KUBE_HOST": "test-host",
662662
})
663663
},
664664
ProviderFactories: testAccProviderFactoriesInternal,
665665
Steps: []resource.TestStep{
666666
{
667667
Config: testAccKubernetesProviderConfig("# empty"),
668-
ExpectError: regexp.MustCompile(`"config_paths": conflicts with host`),
668+
ExpectError: regexp.MustCompile(`"host": conflicts with config_paths`),
669669
PlanOnly: true,
670670
ExpectNonEmptyPlan: true,
671671
},
672672
},
673673
})
674674
}
675675

676-
func TestAccKubernetesProvider_host(t *testing.T) {
676+
func TestAccKubernetesProviderConfig_host(t *testing.T) {
677677
resource.Test(t, resource.TestCase{
678678
PreCheck: func() { testAccPreCheckInternal(t) },
679679
ProviderFactories: testAccProviderFactoriesInternal,
@@ -723,13 +723,22 @@ func TestAccKubernetesProvider_host(t *testing.T) {
723723
{
724724
Config: testAccKubernetesProviderConfig(
725725
providerConfig_exec("test-exec") +
726-
providerConfig_token("test-token"),
726+
providerConfig_cluster_ca_certificate("test-ca-cert"),
727727
),
728728
PlanOnly: true,
729729
ExpectNonEmptyPlan: true,
730730
// Error: "exec": all of `cluster_ca_certificate,exec,host` must be specified
731731
ExpectError: regexp.MustCompile("cluster_ca_certificate,exec,host"),
732732
},
733+
{
734+
Config: testAccKubernetesProviderConfig(
735+
providerConfig_exec("test-exec") +
736+
providerConfig_host("https://test-host") +
737+
providerConfig_cluster_ca_certificate("test-ca-cert"),
738+
),
739+
PlanOnly: true,
740+
ExpectNonEmptyPlan: true,
741+
},
733742
{
734743
Config: testAccKubernetesProviderConfig(
735744
providerConfig_token("test-token"),
@@ -765,6 +774,17 @@ func TestAccKubernetesProvider_host(t *testing.T) {
765774
PlanOnly: true,
766775
ExpectNonEmptyPlan: true,
767776
},
777+
{
778+
Config: testAccKubernetesProviderConfig(
779+
providerConfig_host("https://test-host") +
780+
providerConfig_cluster_ca_certificate("test-ca-cert") +
781+
providerConfig_client_cert("test-client-cert"),
782+
),
783+
PlanOnly: true,
784+
ExpectNonEmptyPlan: true,
785+
// Error: "client_certificate": all of `client_certificate,client_key,cluster_ca_certificate,host` must be specified
786+
ExpectError: regexp.MustCompile("client_certificate,client_key,cluster_ca_certificate,host"),
787+
},
768788
},
769789
})
770790
}

0 commit comments

Comments
 (0)