Skip to content

Commit a5fbbec

Browse files
committed
tests: fix and un-skip provider test
1 parent a11e584 commit a5fbbec

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

internal/provider/provider_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
1919
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
2020
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
21+
sdkTerraform "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
2122
"github.com/hashicorp/terraform-provider-tfe/internal/client"
2223
"github.com/hashicorp/terraform-provider-tfe/version"
2324
"github.com/hashicorp/terraform-svchost/disco"
@@ -176,7 +177,6 @@ func TestSkipUnlessAfterDate(t *testing.T) {
176177
}
177178

178179
func TestConfigureEnvOrganization(t *testing.T) {
179-
t.Skip()
180180
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
181181
originalTFEOrganization := os.Getenv("TFE_ORGANIZATION")
182182
reset := func() {
@@ -191,7 +191,18 @@ func TestConfigureEnvOrganization(t *testing.T) {
191191
expectedOrganization := fmt.Sprintf("tst-organization-%d", rInt)
192192
os.Setenv("TFE_ORGANIZATION", expectedOrganization)
193193

194-
config := Provider().Meta().(ConfiguredClient)
194+
provider := Provider()
195+
196+
// The credentials must be provided by the CLI config file for testing.
197+
if diags := provider.Configure(context.Background(), &sdkTerraform.ResourceConfig{}); diags.HasError() {
198+
for _, d := range diags {
199+
if d.Severity == diag.Error {
200+
t.Fatalf("err: %s", d.Summary)
201+
}
202+
}
203+
}
204+
205+
config := provider.Meta().(ConfiguredClient)
195206
if config.Organization != expectedOrganization {
196207
t.Fatalf("unexpected organization configuration: got %s, wanted %s", config.Organization, expectedOrganization)
197208
}

0 commit comments

Comments
 (0)