Skip to content

Commit

Permalink
Fix acceptance tests (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
erademacher committed Nov 4, 2022
1 parent 994030e commit 4c0fed6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions internal/provider/cluster_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ func TestAccServerlessClusterResource(t *testing.T) {
func TestIntegrationServerlessClusterResource(t *testing.T) {
clusterName := fmt.Sprintf("tftest-serverless-%s", GenerateRandomString(2))
clusterID := "cluster-id"
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down Expand Up @@ -122,8 +123,9 @@ func TestAccDedicatedClusterResource(t *testing.T) {
func TestIntegrationDedicatedClusterResource(t *testing.T) {
clusterName := fmt.Sprintf("tftest-dedicated-%s", GenerateRandomString(3))
clusterID := "cluster-id"
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down
5 changes: 3 additions & 2 deletions internal/provider/networking_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ func TestIntegrationAllowlistEntryResource(t *testing.T) {
Sql: true,
Ui: true,
}
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func TestIntegrationPrivateEndpointConnectionResource(t *testing.T) {
clusterName := fmt.Sprintf("aws-connection-%s", GenerateRandomString(5))
clusterID := "cluster-id"
endpointID := "endpoint-id"
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down
5 changes: 3 additions & 2 deletions internal/provider/private_endpoint_services_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ func TestAccPrivateEndpointServicesResource(t *testing.T) {
func TestIntegrationPrivateEndpointServicesResource(t *testing.T) {
clusterName := fmt.Sprintf("endpoint-services-%s", GenerateRandomString(3))
clusterID := "cluster-id"
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down
5 changes: 3 additions & 2 deletions internal/provider/sql_user_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func TestIntegrationSqlUserResource(t *testing.T) {
sqlUserName := "cockroach-user"
sqlPassword := "cockroach@123456"
clusterID := "cluster-id"
os.Setenv("COCKROACH_API_KEY", "fake")
defer os.Unsetenv("COCKROACH_API_KEY")
if os.Getenv(CockroachAPIKey) == "" {
os.Setenv(CockroachAPIKey, "fake")
}

ctrl := gomock.NewController(t)
s := mock_client.NewMockService(ctrl)
Expand Down

0 comments on commit 4c0fed6

Please sign in to comment.