Skip to content

Commit f429e74

Browse files
authored
refactor: change dev to test (#64)
* refactor: change dev to test * chore: fix test
1 parent 5c57f7f commit f429e74

12 files changed

+47
-43
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ air -c scripts/.air.toml
4444
# install the provider in your local machine
4545
cd terraform-provider-bytebase && make install
4646

47+
# test
48+
# Any BYTEBASE_SERVICE_ACCOUNT/BYTEBASE_SERVICE_KEY/BYTEBASE_URL value should work since the service is mocked
49+
TF_ACC=1 [email protected] BYTEBASE_SERVICE_KEY=test_secret BYTEBASE_URL=https://bytebase.example.com go test -v ./...
50+
4751
# initialize the terraform for your example
4852
# you need to set the service_account and service_key to your own
4953
cd examples/setup && terraform init

examples/roles/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data "bytebase_instance_role_list" "all" {
1717
## Find role by name
1818

1919
```terraform
20-
data "bytebase_instance_role" "dev" {
20+
data "bytebase_instance_role" "test" {
2121
name = "<the role name>"
2222
instance = "<the instance resource id>"
2323
}

examples/setup/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Setup examples
22

33
This is the setup for examples.
4-
We will create two environments named `dev` and `prod`. Each environment contains one instance.
4+
We will create two environments named `test` and `prod`. Each environment contains one instance.
55

66
Before you start, please make sure you have running your Bytebase service and have created the service account, and replace the provider initial variables. Check the [README](../README.md) for details.
77

provider/data_source_environment_list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestAccEnvironmentListDataSource(t *testing.T) {
2828
0,
2929
),
3030
internal.GetTestStepForDataSourceList(
31-
testAccCheckEnvironmentResource(identifier, "dev", 1),
31+
testAccCheckEnvironmentResource(identifier, "test", 1),
3232
fmt.Sprintf("bytebase_environment.%s", identifier),
3333
"bytebase_environment_list",
3434
"after",

provider/data_source_environment_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
)
1212

1313
func TestAccEnvironmentDataSource(t *testing.T) {
14-
identifier := "dev"
14+
identifier := "test"
1515
resourceName := fmt.Sprintf("bytebase_environment.%s", identifier)
16-
title := "dev"
16+
title := "test"
1717
order := 1
1818

1919
resource.Test(t, resource.TestCase{

provider/data_source_instance_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ func TestAccInstanceDataSource(t *testing.T) {
1414
identifier := "new_instance"
1515
resourceName := fmt.Sprintf("bytebase_instance.%s", identifier)
1616

17-
resourceID := "dev-instance"
18-
title := "dev instance"
17+
resourceID := "test-instance"
18+
title := "test instance"
1919
engine := "POSTGRES"
20-
environment := "dev"
20+
environment := "test"
2121

2222
resource.Test(t, resource.TestCase{
2323
PreCheck: func() {
@@ -57,7 +57,7 @@ func TestAccInstanceDataSource_NotFound(t *testing.T) {
5757
Config: testAccCheckInstanceDataSource(
5858
"",
5959
"",
60-
"dev_instance",
60+
"test_instance",
6161
"mock-id",
6262
),
6363
ExpectError: regexp.MustCompile("Cannot found instance"),

provider/data_source_policy_list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestAccPolicyListDataSource(t *testing.T) {
2828
internal.GetTestStepForDataSourceList(
2929
testAccCheckPolicyResource(
3030
"backup_plan",
31-
"dev",
31+
"test",
3232
getBackupPlanPolicy(string(api.BackupPlanScheduleDaily), 999),
3333
api.PolicyTypeBackupPlan,
3434
),

provider/data_source_policy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ func TestAccPolicyDataSource(t *testing.T) {
2323
Config: testAccCheckPolicyDataSource(
2424
testAccCheckPolicyResource(
2525
"backup_plan",
26-
"dev",
26+
"test",
2727
getBackupPlanPolicy(string(api.BackupPlanScheduleDaily), 999),
2828
api.PolicyTypeBackupPlan,
2929
),
3030
"backup_plan",
31-
"dev",
31+
"test",
3232
"bytebase_policy.backup_plan",
3333
api.PolicyTypeBackupPlan,
3434
),
@@ -56,11 +56,11 @@ func TestAccPolicyDataSource_NotFound(t *testing.T) {
5656
Config: testAccCheckPolicyDataSource(
5757
"",
5858
"policy",
59-
"dev",
59+
"test",
6060
"",
6161
api.PolicyTypeDeploymentApproval,
6262
),
63-
ExpectError: regexp.MustCompile(fmt.Sprintf("Cannot found policy environments/dev/policies/%s", api.PolicyTypeDeploymentApproval)),
63+
ExpectError: regexp.MustCompile("Cannot found policy environments/test/policies/DEPLOYMENT_APPROVAL"),
6464
},
6565
},
6666
})

provider/resource_database_role_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func mockInstanceResource(resourceID string) string {
120120
resource_id = "%s"
121121
title = "%s"
122122
engine = "POSTGRES"
123-
environment = "dev"
123+
environment = "test"
124124
125125
data_sources {
126126
title = "admin data source"

provider/resource_environment_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestAccEnvironment(t *testing.T) {
1717
identifier := "new-environment"
1818
resourceName := fmt.Sprintf("bytebase_environment.%s", identifier)
1919

20-
title := "dev"
20+
title := "test"
2121
order := 1
2222
titleUpdated := fmt.Sprintf("%supdated", title)
2323

@@ -62,8 +62,8 @@ func TestAccEnvironment_InvalidInput(t *testing.T) {
6262
{
6363
Config: `
6464
resource "bytebase_environment" "new_env" {
65-
resource_id = "dev"
66-
title = "Dev"
65+
resource_id = "test"
66+
title = "Test"
6767
environment_tier_policy = "PROTECTED"
6868
}
6969
`,
@@ -73,7 +73,7 @@ func TestAccEnvironment_InvalidInput(t *testing.T) {
7373
{
7474
Config: `
7575
resource "bytebase_environment" "new_env" {
76-
resource_id = "dev"
76+
resource_id = "test"
7777
title = ""
7878
order = 1
7979
environment_tier_policy = "PROTECTED"
@@ -85,8 +85,8 @@ func TestAccEnvironment_InvalidInput(t *testing.T) {
8585
{
8686
Config: `
8787
resource "bytebase_environment" "new_env" {
88-
resource_id = "dev"
89-
title = "Dev"
88+
resource_id = "test"
89+
title = "Test"
9090
order = 1
9191
environment_tier_policy = "UNKNOWN"
9292
}

0 commit comments

Comments
 (0)