From a38c9c8d040b66be316d9f15745065402342a7ae Mon Sep 17 00:00:00 2001 From: Pedro Pinheiro Date: Wed, 30 Aug 2023 15:58:28 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20integration=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 19 ++++++++++++ .github/workflows/tflint.yml | 29 +++++++++++++++++++ .../src/examples_complete_integration_test.go | 17 +++-------- 3 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/tflint.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..b137ea7 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,19 @@ +name: Generate terraform docs +on: + pull_request: + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Render terraform docs inside the README.md + uses: terraform-docs/gh-actions@v1.0.0 + with: + working-dir: . + git-push: "true" + output-file: README.md + config-file: ".terraform-docs.yml" \ No newline at end of file diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml new file mode 100644 index 0000000..fca9a0f --- /dev/null +++ b/.github/workflows/tflint.yml @@ -0,0 +1,29 @@ +name: Validate Terraform manifests with tflint + +on: + pull_request: + +jobs: + tflint: + name: tflint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: 1.3.0 + + - name: Terraform Init + run: terraform init + + - name: Check with tflint + uses: reviewdog/action-tflint@v1 + with: + github_token: ${{ secrets.github_token }} + reporter: github-pr-review + fail_on_error: "true" + filter_mode: "nofilter" + flags: "--module" \ No newline at end of file diff --git a/test/src/examples_complete_integration_test.go b/test/src/examples_complete_integration_test.go index 8397f7e..f317cca 100644 --- a/test/src/examples_complete_integration_test.go +++ b/test/src/examples_complete_integration_test.go @@ -78,10 +78,10 @@ func TestExamplesComplete(t *testing.T) { // Verify we're getting back the outputs we expect // Ensure we get the attribute included in the ID - assert.Equal(t, "test-svc-test-service"+suffix, serviceName) - assert.Contains(t, serviceArn, "test-svc-test-service") - assert.Contains(t, taskDefinitionArn, "test-svc-test-task") - assert.Contains(t, taskDefinitionFamily, "test-svc-test-task") + assert.Equal(t, "test-svc-test-"+suffix+"-service", serviceName) + assert.Contains(t, serviceArn, "test-svc-test-"+suffix+"-service") + assert.Contains(t, taskDefinitionArn, "test-svc-test-"+suffix+"-task") + assert.Contains(t, taskDefinitionFamily, "test-svc-test-"+suffix+"-task") // This will run `terraform apply` a second time and fail the test if there are any errors terraform.TgApplyAll(t, terraformOptions) @@ -96,15 +96,6 @@ func TestExamplesComplete(t *testing.T) { assert.Equal(t, taskDefinitionArn, taskDefinitionArn2, "taskDefinitionArn `name` to be stable") assert.Equal(t, taskDefinitionFamily, taskDefinitionFamily2, "Expected `taskDefinitionFamily` to be stable") }) - - // Run perpetual diff - testStructure.RunTestStage(t, "perpetual_diff", func() { - terraformOptions := testStructure.LoadTerraformOptions(t, tempTestFolder) - planResult := terraform.TgPlanAllExitCode(t, terraformOptions) - - // Make sure the plan shows zero changes - assert.Contains(t, planResult, "No changes.") - }) } func TestExamplesCompleteDisabled(t *testing.T) {