Skip to content

Commit

Permalink
Merge pull request #11821 from terraform-providers/bt-aws-glue-govclo…
Browse files Browse the repository at this point in the history
…ud-sweeper

Prevents acc tests and sweeper for AWS Glue workflows in GovCloud
  • Loading branch information
gdavison authored Feb 13, 2020
2 parents 30aaaa3 + 04603cf commit 0efdad0
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions aws/resource_aws_glue_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ func testSweepGlueWorkflow(region string) error {
}
conn := client.(*AWSClient).glueconn

listWorkflowInput := &glue.ListWorkflowsInput{}

listOutput, err := conn.ListWorkflows(listWorkflowInput)
listOutput, err := conn.ListWorkflows(&glue.ListWorkflowsInput{})
if err != nil {
if testSweepSkipSweepError(err) {
// Some endpoints that do not support Glue Workflows return InternalFailure
if testSweepSkipSweepError(err) || isAWSErr(err, "InternalFailure", "") {
log.Printf("[WARN] Skipping Glue Workflow sweep for %s: %s", region, err)
return nil
}
Expand All @@ -52,7 +51,7 @@ func TestAccAWSGlueWorkflow_Basic(t *testing.T) {
resourceName := "aws_glue_workflow.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSGlueWorkflowDestroy,
Steps: []resource.TestStep{
Expand All @@ -79,7 +78,7 @@ func TestAccAWSGlueWorkflow_DefaultRunProperties(t *testing.T) {
resourceName := "aws_glue_workflow.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSGlueWorkflowDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -108,7 +107,7 @@ func TestAccAWSGlueWorkflow_Description(t *testing.T) {
resourceName := "aws_glue_workflow.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSGlueWorkflowDestroy,
Steps: []resource.TestStep{
Expand All @@ -135,6 +134,21 @@ func TestAccAWSGlueWorkflow_Description(t *testing.T) {
})
}

func testAccPreCheckAWSGlueWorkflow(t *testing.T) {
conn := testAccProvider.Meta().(*AWSClient).glueconn

_, err := conn.ListWorkflows(&glue.ListWorkflowsInput{})

// Some endpoints that do not support Glue Workflows return InternalFailure
if testAccPreCheckSkipError(err) || isAWSErr(err, "InternalFailure", "") {
t.Skipf("skipping acceptance testing: %s", err)
}

if err != nil {
t.Fatalf("unexpected PreCheck error: %s", err)
}
}

func testAccCheckAWSGlueWorkflowExists(resourceName string, workflow *glue.Workflow) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resourceName]
Expand Down

0 comments on commit 0efdad0

Please sign in to comment.