Skip to content

Commit 97bbc52

Browse files
committed
ref: rename test package to provider_test
1 parent c09b813 commit 97bbc52

18 files changed

+46
-47
lines changed

internal/acctest/acctest.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import (
66
"os"
77
"testing"
88

9+
"github.com/hashicorp/terraform-plugin-framework/providerserver"
10+
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
911
"github.com/jianyuan/go-utils/must"
1012
"github.com/jianyuan/terraform-provider-openai/internal/apiclient"
13+
"github.com/jianyuan/terraform-provider-openai/internal/provider"
1114
)
1215

1316
var (
@@ -36,3 +39,11 @@ func PreCheck(t *testing.T) {
3639
t.Fatal("OPENAI_TEST_USER_ID must be set for acceptance tests")
3740
}
3841
}
42+
43+
// testAccProtoV6ProviderFactories are used to instantiate a provider during
44+
// acceptance testing. The factory function will be invoked for every Terraform
45+
// CLI command executed to create a provider server to which the CLI can
46+
// reattach.
47+
var TestAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
48+
"openai": providerserver.NewProtocol6WithError(provider.New("test")()),
49+
}

internal/provider/data_source_invite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"fmt"
@@ -18,7 +18,7 @@ func TestAccInviteDataSource(t *testing.T) {
1818

1919
resource.Test(t, resource.TestCase{
2020
PreCheck: func() { acctest.PreCheck(t) },
21-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
21+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
2222
Steps: []resource.TestStep{
2323
{
2424
Config: testAccInviteDataSourceConfig(email),

internal/provider/data_source_invites_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"testing"
@@ -15,7 +15,7 @@ func TestAccInvitesDataSource(t *testing.T) {
1515

1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acctest.PreCheck(t) },
18-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
18+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
1919
Steps: []resource.TestStep{
2020
{
2121
Config: testAccInvitesDataSourceConfig,

internal/provider/data_source_project_rate_limits_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"testing"
@@ -15,7 +15,7 @@ func TestAccProjectRateLimitsDataSource(t *testing.T) {
1515

1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acctest.PreCheck(t) },
18-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
18+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
1919
Steps: []resource.TestStep{
2020
{
2121
Config: testAccProjectRateLimitsDataSourceConfig,

internal/provider/data_source_project_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"fmt"
@@ -17,7 +17,7 @@ func TestAccProjectDataSource(t *testing.T) {
1717

1818
resource.Test(t, resource.TestCase{
1919
PreCheck: func() { acctest.PreCheck(t) },
20-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
20+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
2121
Steps: []resource.TestStep{
2222
{
2323
Config: testAccProjectDataSourceConfig(projectName),

internal/provider/data_source_projects_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"testing"
@@ -15,7 +15,7 @@ func TestAccProjectsDataSource(t *testing.T) {
1515

1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acctest.PreCheck(t) },
18-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
18+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
1919
Steps: []resource.TestStep{
2020
{
2121
Config: testAccProjectsDataSourceConfig,
@@ -40,7 +40,7 @@ func TestAccProjectsDataSource_includeArchived(t *testing.T) {
4040

4141
resource.Test(t, resource.TestCase{
4242
PreCheck: func() { acctest.PreCheck(t) },
43-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
43+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
4444
Steps: []resource.TestStep{
4545
{
4646
Config: testAccProjectsDataSourceConfig_includeArchived,

internal/provider/data_source_user_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"fmt"
@@ -16,7 +16,7 @@ func TestAccUserDataSource(t *testing.T) {
1616

1717
resource.Test(t, resource.TestCase{
1818
PreCheck: func() { acctest.PreCheck(t) },
19-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
19+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
2020
Steps: []resource.TestStep{
2121
{
2222
Config: testAccUserDataSourceConfig,

internal/provider/data_source_users_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"testing"
@@ -15,7 +15,7 @@ func TestAccUsersDataSource(t *testing.T) {
1515

1616
resource.Test(t, resource.TestCase{
1717
PreCheck: func() { acctest.PreCheck(t) },
18-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
18+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
1919
Steps: []resource.TestStep{
2020
{
2121
Config: testAccUsersDataSourceConfig,

internal/provider/provider_test.go

Lines changed: 0 additions & 14 deletions
This file was deleted.

internal/provider/resource_admin_api_key_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package provider
1+
package provider_test
22

33
import (
44
"context"
@@ -71,7 +71,7 @@ func TestAccAdminApiKeyResource(t *testing.T) {
7171

7272
resource.Test(t, resource.TestCase{
7373
PreCheck: func() { acctest.PreCheck(t) },
74-
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
74+
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
7575
Steps: []resource.TestStep{
7676
{
7777
Config: testAccAdminApiKeyResourceConfig(name),

0 commit comments

Comments
 (0)