@@ -491,7 +491,7 @@ func TestAccKubernetesProvider_config_path(t *testing.T) {
491491 Config : testAccKubernetesProviderConfig (
492492 providerConfig_config_path ("./testdata/kubeconfig" ),
493493 ),
494- Check : resource . TestCheckResourceAttr ( "data.kubernetes_namespace.test" , "metadata.0.name" , "default" ) ,
494+ PlanOnly : true ,
495495 },
496496 },
497497 })
@@ -506,21 +506,24 @@ func TestAccKubernetesProvider_config_paths(t *testing.T) {
506506 Config : testAccKubernetesProviderConfig (
507507 providerConfig_config_paths (`["./missing/file", "./testdata/kubeconfig"]` ),
508508 ),
509- Check : resource .TestCheckResourceAttr ("data.kubernetes_namespace.test" , "metadata.0.name" , "default" ),
510- ExpectError : regexp .MustCompile ("could not open kubeconfig" ),
509+ ExpectError : regexp .MustCompile ("could not open kubeconfig" ),
510+ PlanOnly : true ,
511+ ExpectNonEmptyPlan : true ,
511512 },
512513 {
513514 Config : testAccKubernetesProviderConfig (
514515 providerConfig_config_path ("./internal/testdata/kubeconfig" ) +
515516 providerConfig_config_paths (`["./testdata/kubeconfig", "./testdata/kubeconfig"]` ),
516517 ),
517- ExpectError : regexp .MustCompile (`"config_path": conflicts with config_paths` ),
518+ ExpectError : regexp .MustCompile (`"config_path": conflicts with config_paths` ),
519+ PlanOnly : true ,
520+ ExpectNonEmptyPlan : true ,
518521 },
519522 {
520523 Config : testAccKubernetesProviderConfig (
521524 providerConfig_config_paths (`["./testdata/kubeconfig", "./testdata/kubeconfig"]` ),
522525 ),
523- Check : resource . TestCheckResourceAttr ( "data.kubernetes_namespace.test" , "metadata.0.name" , "default" ) ,
526+ PlanOnly : true ,
524527 },
525528 },
526529 })
@@ -561,13 +564,15 @@ func TestAccKubernetesProvider_config_paths_env_wantError(t *testing.T) {
561564 "./testdata/kubeconfig" ,
562565 "./testdata/kubeconfig" ,
563566 }, string (os .PathListSeparator )),
567+ "KUBE_CONFIG_PATH" : "./testdata/kubeconfig" ,
564568 })
565569 },
566570 ProviderFactories : testAccProviderFactoriesInternal ,
567571 Steps : []resource.TestStep {
568572 {
569573 Config : testAccKubernetesProviderConfig ("# empty" ),
570574 ExpectError : regexp .MustCompile (wantError ),
575+ PlanOnly : true ,
571576 },
572577 },
573578 })
@@ -580,11 +585,12 @@ func testAccKubernetesProviderConfig(providerConfig string) string {
580585 %s
581586}
582587
583- #data kubernetes_namespace "test" {
584- # metadata {
585- # name = "default"
586- # }
587- #}
588+ # Needed for provider initialization.
589+ resource kubernetes_namespace "test" {
590+ metadata {
591+ name = "tf-k8s-acc-test"
592+ }
593+ }
588594` , providerConfig )
589595}
590596
0 commit comments