Skip to content

Commit

Permalink
DWX-18779 DW acceptance tests for catalog, hive
Browse files Browse the repository at this point in the history
Cover the dw environment, db catalog and hive vw creations and
deletions as part of acceptance testing.
  • Loading branch information
tevesz committed Nov 6, 2024
1 parent b299e93 commit b4f9d21
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// OF ANY KIND, either express or implied. Refer to the License for the specific
// permissions and limitations governing your use of the file.

package aws_test
package dw

import (
"context"
Expand Down Expand Up @@ -132,7 +132,9 @@ func TestAccCluster_basic(t *testing.T) {
testAccAwsCredentialBasicConfig(credName, os.Getenv(AwsXAccRoleArn)),
testAccAwsEnvironmentConfig(&envParams),
testAccAwsDataLakeConfig(&dlParams),
testAccAwsClusterBasicConfig(&envParams)),
testAccAwsClusterBasicConfig(&envParams),
testAccDwCatalog(),
testAccHiveVirtualWarehouse()),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", envParams.Name),
resource.TestCheckResourceAttr(resourceName, "status", "Accepted"),
Expand Down Expand Up @@ -226,6 +228,24 @@ func testAccAwsClusterBasicConfig(params *awsEnvironmentTestParameters) string {
`, params.SubnetIds)
}

func testAccDwCatalog() string {
return `
resource "cdp_dw_database_catalog" "test_catalog" {
cluster_id = cdp_dw_aws_cluster.test_data_warehouse_aws.cluster_id
}
`
}

func testAccHiveVirtualWarehouse() string {
return `
resource "cdp_vw_hive" "test_hive" {
cluster_id = cdp_dw_aws_cluster.test_data_warehouse_aws.cluster_id
database_catalog_id = cdp_dw_database_catalog.test_catalog.id
name = "tf-test-hive"
}
`
}

func testCheckClusterDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
if rs.Type != "cdp_dw_aws_cluster" {
Expand Down

0 comments on commit b4f9d21

Please sign in to comment.