Skip to content

Commit 179a882

Browse files
author
Uddipaan Hazarika
committed
ECO-5623 | fixing acceptance tests
1 parent 1c4a688 commit 179a882

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

internal/provider/resource_appdata_dsource_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ func TestDsource_create_positive(t *testing.T) {
1717
name := os.Getenv("DSOURCE_NAME")
1818
environmentUser := os.Getenv("DSOURCE_ENV_USER")
1919
stagingEnvironment := os.Getenv("DSOURCE_STAGE_ENV")
20-
postgresPort := os.Getenv("DSOURCE_POSTGRES_PORT")
20+
parameters := os.Getenv("DSOURCE_PARAMETERS")
2121

2222
resource.Test(t, resource.TestCase{
2323
PreCheck: func() {
24-
testDsourcePreCheck(t, sourceId, groupId, name, environmentUser, stagingEnvironment, postgresPort)
24+
testDsourcePreCheck(t, sourceId, groupId, name, environmentUser, stagingEnvironment, parameters)
2525
},
2626
Providers: testAccProviders,
2727
CheckDestroy: testDsourceDestroy,
@@ -31,13 +31,13 @@ func TestDsource_create_positive(t *testing.T) {
3131
ExpectError: regexp.MustCompile(`.*`),
3232
},
3333
{
34-
Config: testDsourceBasic(sourceId, groupId, name, environmentUser, stagingEnvironment, postgresPort),
34+
Config: testDsourceBasic(sourceId, groupId, name, environmentUser, stagingEnvironment, parameters),
3535
Check: resource.ComposeTestCheckFunc(
3636
testDsourceExists("delphix_appdata_dsource.new_data_dsource", sourceId),
3737
resource.TestCheckResourceAttr("delphix_appdata_dsource.new_data_dsource", "source_id", sourceId)),
3838
},
3939
{
40-
Config: testDsourceUpdate(sourceId, groupId, "update_same_dsource", environmentUser, stagingEnvironment, postgresPort),
40+
Config: testDsourceUpdate(sourceId, groupId, "update_same_dsource", environmentUser, stagingEnvironment, parameters),
4141
Check: resource.ComposeAggregateTestCheckFunc(
4242
// irrelevant
4343
),
@@ -47,7 +47,7 @@ func TestDsource_create_positive(t *testing.T) {
4747
})
4848
}
4949

50-
func testDsourcePreCheck(t *testing.T, sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, postgresPort string) {
50+
func testDsourcePreCheck(t *testing.T, sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, parameters string) {
5151
testAccPreCheck(t)
5252
if sourceId == "" {
5353
t.Fatal("DSOURCE_SOURCE_ID must be set for env acceptance tests")
@@ -64,12 +64,12 @@ func testDsourcePreCheck(t *testing.T, sourceId string, groupId string, name str
6464
if stagingEnvironment == "" {
6565
t.Fatal("DSOURCE_STAGE_ENV must be set for env acceptance tests")
6666
}
67-
if postgresPort == "" {
68-
t.Fatal("DSOURCE_POSTGRES_PORT must be set for env acceptance tests")
67+
if parameters == "" {
68+
t.Fatal("DSOURCE_PARAMETERS must be set for env acceptance tests")
6969
}
7070
}
7171

72-
func testDsourceBasic(sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, postgresPort string) string {
72+
func testDsourceBasic(sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, parameters string) string {
7373
return fmt.Sprintf(`
7474
resource "delphix_appdata_dsource" "new_data_dsource" {
7575
source_value = "%s"
@@ -86,10 +86,10 @@ resource "delphix_appdata_dsource" "new_data_dsource" {
8686
resync = true
8787
})
8888
}
89-
`, sourceId, groupId, name, environmentUser, stagingEnvironment, postgresPort)
89+
`, sourceId, groupId, name, environmentUser, stagingEnvironment, parameters)
9090
}
9191

92-
func testDsourceUpdate(sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, postgresPort string) string {
92+
func testDsourceUpdate(sourceId string, groupId string, name string, environmentUser string, stagingEnvironment string, parameters string) string {
9393
return fmt.Sprintf(`
9494
resource "delphix_appdata_dsource" "new_data_dsource" {
9595
source_value = "%s"
@@ -106,7 +106,7 @@ resource "delphix_appdata_dsource" "new_data_dsource" {
106106
resync = true
107107
})
108108
}
109-
`, sourceId, groupId, name, environmentUser, stagingEnvironment, postgresPort)
109+
`, sourceId, groupId, name, environmentUser, stagingEnvironment, parameters)
110110
}
111111

112112
func testDsourceExists(n string, sourceId string) resource.TestCheckFunc {

internal/provider/resource_vdb_test.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ func testAccVdbAppDataPreCheck(t *testing.T) {
9393
if err := os.Getenv("APPDATA_SOURCE_PARAMS"); err == "" {
9494
t.Fatal("APPDATA_SOURCE_PARAMS must be set for vdb acceptance tests")
9595
}
96-
if err := os.Getenv("APPDATA_CONFIG_PARAMS"); err == "" {
97-
t.Fatal("APPDATA_CONFIG_PARAMS must be set for vdb acceptance tests")
98-
}
9996
}
10097

10198
func testAccCheckDctVDBConfigBasic() string {
@@ -111,15 +108,13 @@ func testAccCheckDctVDBConfigBasic() string {
111108
func testAccCheckDctVDBConfigAppDataBasic() string {
112109
appdata_datasource_id := os.Getenv("APPDATA_DATASOURCE_ID")
113110
appdata_source_params := os.Getenv("APPDATA_SOURCE_PARAMS")
114-
appdata_config_params := os.Getenv("APPDATA_CONFIG_PARAMS")
115111
return fmt.Sprintf(`
116112
resource "delphix_vdb" "new_appdata" {
117113
auto_select_repository = true
118114
source_data_id = "%s"
119115
appdata_source_params = jsonencode(%s)
120-
appdata_config_params = jsonencode(%s)
121116
}
122-
`, appdata_datasource_id, appdata_source_params, appdata_config_params)
117+
`, appdata_datasource_id, appdata_source_params)
123118
}
124119

125120
func testAccCheckDctVDBBookmarkConfigBasic() string {
@@ -185,8 +180,6 @@ func testAccCheckDctVDBBookmarkConfigBasic() string {
185180
}
186181
`, bookmark_id)
187182

188-
print(resource)
189-
190183
return resource
191184

192185
}
@@ -314,8 +307,6 @@ func testAccCheckVdbDestroy(s *terraform.State) error {
314307

315308
func testAccCheckVdbDestroyBookmark(s *terraform.State) error {
316309
client := testAccProvider.Meta().(*apiClient).client
317-
318-
print("Deleting parent vdb " + vdb_id)
319310
deleteVdbParams := dctapi.NewDeleteVDBParametersWithDefaults()
320311
deleteVdbParams.SetForce(false)
321312
client.VDBsAPI.DeleteVdb(context.Background(), vdb_id).DeleteVDBParameters(*deleteVdbParams).Execute()

0 commit comments

Comments
 (0)