Skip to content

feat: Adding integration tests#4198

Merged
yhakbar merged 88 commits intomainfrom
feat/adding-integration-tests
May 7, 2025
Merged

feat: Adding integration tests#4198
yhakbar merged 88 commits intomainfrom
feat/adding-integration-tests

Conversation

@yhakbar
Copy link
Copy Markdown
Collaborator

@yhakbar yhakbar commented Apr 22, 2025

Description

Adds integration tests, including the system where we'll add optional extra tests that have particular build tags and prefixed test names.

Included changes:

  • updated matrix integration test to run multiple setup scripts
  • fixed SOPS and SSH tests
  • added engine tests
  • added mise configuration for CICD
  • added support for setting secrets for each test
  • added option to skip tests

Example execution:
image

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added integration tests to GHA.

Migration Guide

Summary by CodeRabbit

  • New Features

    • Added new integration test workflow with multiple test categories and improved reporting.
    • Introduced several setup scripts for engine, GCP, SOPS, SSH key management, secrets generation, and setup automation.
    • Added configuration for consistent tool versions across CI/CD environments.
    • Added new pre-commit workflow for automated code checks.
  • Bug Fixes

    • Improved test isolation in SSH CAS getter tests to prevent shared state issues.
    • Enhanced temporary directory naming for reduced conflicts in Git operations.
  • Refactor

    • Renamed several test functions for consistency and clarity.
    • Updated test fixtures to use new paths and references.
  • Chores

    • Simplified CI pipeline by removing obsolete test jobs and related environment variables.
    • Updated pre-commit configuration and tool versions.
    • Improved test reporting and artifact management in CI workflows.
    • Removed Go module cache caching in build-no-proxy workflow.
  • Tests

    • Added new race condition test for CAS getter functionality.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
terragrunt-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2025 3:10pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 22, 2025

Warning

Rate limit exceeded

@yhakbar has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8a92977 and b8b7b75.

📒 Files selected for processing (3)
  • .github/scripts/setup/generate-secrets.sh (1 hunks)
  • .github/scripts/setup/run-setup-scripts.sh (1 hunks)
  • .github/workflows/integration-test.yml (1 hunks)
📝 Walkthrough

"""

Walkthrough

This update removes the unit_test and integration_test_tofu_engine jobs from the CircleCI configuration, eliminates a related environment variable, and introduces new GitHub Actions workflows for integration tests and pre-commit checks. Several supporting shell scripts and a tool version configuration file are added, while test naming and fixture references are standardized or updated.

Changes

File(s) Change Summary
.circleci/config.yml Removed unit_test and integration_test_tofu_engine jobs and related env var/workflow entries.
.github/scripts/setup/engine.sh
.github/scripts/setup/gcp.sh
.github/scripts/setup/sops.sh
.github/scripts/setup/ssh.sh
.github/scripts/setup/generate-secrets.sh
.github/scripts/setup/run-setup-scripts.sh
Added new shell scripts for engine setup, GCP authentication, SOPS key import, SSH key setup, secret environment generation, and setup scripts execution.
.github/workflows/base-test.yml Enhanced test reporting: added JUnit output, artifact upload, and test result summary steps.
.github/workflows/build-no-proxy.yml Removed Go module cache output/caching; build cache caching remains.
.github/workflows/integration-test.yml Added new integration test workflow with a matrix of test suites, secrets handling, and setup scripts.
.github/workflows/precommit.yml Added new pre-commit workflow for running pre-commit hooks on pushes and PRs.
.pre-commit-config.yaml Updated to newer gruntwork-io/pre-commit revision; replaced terraform-fmt with tofu-fmt.
internal/cas/getter_ssh_test.go Refactored test setup for isolation: CAS client and dependencies now created per subtest.
internal/cas/git.go Improved temp dir naming with nanosecond timestamp for uniqueness in CreateTempDir.
internal/cas/race_test.go Added new test for verifying CAS getter race condition handling.
mise.cicd.toml Added tool version configuration for CI/CD environment consistency.
test/fixtures/download/remote-ref/terragrunt.hcl
test/fixtures/source-map/slashes-in-ref/terragrunt.hcl
Updated fixture source URLs and Git refs for test consistency.
test/integration_sops_test.go Renamed SOPS test functions for naming consistency; updated CLI flags and output handling in one test.
test/integration_tflint_test.go Renamed Tflint test functions for naming consistency.
test/integration_units_reading_test.go Renamed units reading test function for naming consistency.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Setup Script
    participant Test Runner

    GitHub Actions->>Setup Script: Run setup script (engine/gcp/sops/ssh/generate-secrets/run-setup-scripts)
    Setup Script-->>GitHub Actions: Environment prepared

    GitHub Actions->>Test Runner: Run tests (unit/integration/pre-commit)
    Test Runner-->>GitHub Actions: Test results (JUnit XML/artifacts)
    GitHub Actions->>GitHub Actions: Upload artifacts & display summary
Loading

Possibly related PRs

  • gruntwork-io/terragrunt#4193: Adds OpenTofu installation step to unit_test job, which is deleted in this PR; directly related to the same job.
  • gruntwork-io/terragrunt#4172: Removes lint steps from unit_test and deletes strict_lint job in CircleCI; overlaps with this PR's removal of unit_test job.
  • gruntwork-io/terragrunt#3995: Removes install_tofu_engine step from integration_test_tofu_engine job; related as both PRs modify tofu engine integration tests in CircleCI.

Suggested reviewers

  • levkohimins
  • yhakbar
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (14)
.github/scripts/setup/aws.sh (1)

1-4: Add environment variable validation.
The script enters strict mode but doesn’t confirm that AWS credentials are present. To fail fast, consider adding checks such as:

: "${AWS_ACCESS_KEY_ID?AWS_ACCESS_KEY_ID is required}"
: "${AWS_SECRET_ACCESS_KEY?AWS_SECRET_ACCESS_KEY is required}"
.github/scripts/setup/sops.sh (1)

1-6: Check for gpg availability.
To provide a clearer error when GPG is missing, add:

command -v gpg >/dev/null 2>&1 || { echo "gpg not found. Please install GPG."; exit 1; }

This helps avoid confusing failures during the key import.

.github/scripts/setup/gcp.sh (1)

3-6: Validate and secure GCP service key.
Add a check to ensure GCLOUD_SERVICE_KEY is set and restrict the credentials file permissions:

 set -euo pipefail
+: "${GCLOUD_SERVICE_KEY?GCLOUD_SERVICE_KEY is required for GCP auth}"
 echo "$GCLOUD_SERVICE_KEY" > "${HOME}/gcloud-service-key.json"
+chmod 600 "${HOME}/gcloud-service-key.json"
 export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/gcloud-service-key.json"
.github/scripts/setup/engine.sh (1)

3-13: Improve robustness and cleanup for engine download.
Consider using a temporary directory, validating required tools, and cleaning up after download:

-set -euo pipefail
-export TOFU_ENGINE_VERSION="v0.0.16"
-export REPO="gruntwork-io/terragrunt-engine-opentofu"
-export ASSET_NAME="terragrunt-iac-engine-opentofu_rpc_${TOFU_ENGINE_VERSION}_linux_amd64.zip"
-pushd .
-# Download the engine binary
-mkdir -p /tmp/engine
-cd /tmp/engine
-wget -O "engine.zip" "https://github.com/${REPO}/releases/download/${TOFU_ENGINE_VERSION}/${ASSET_NAME}"
-unzip -o "engine.zip"
-popd
+set -euo pipefail
+command -v wget >/dev/null 2>&1 || { echo "wget is required"; exit 1; }
+command -v unzip >/dev/null 2>&1 || { echo "unzip is required"; exit 1; }
+TMP_DIR=$(mktemp -d)
+trap 'rm -rf "$TMP_DIR"' EXIT
+pushd "$TMP_DIR"
+# Download the engine binary
+wget -qO engine.zip "https://github.com/${REPO}/releases/download/${TOFU_ENGINE_VERSION}/${ASSET_NAME}"
+unzip -o engine.zip
+popd

This approach isolates files in a temp folder and removes them on exit.

.github/scripts/setup/tflint.sh (1)

1-1: Add descriptive header.
Consider adding a top‐of‐file comment explaining the purpose of this script, e.g.:

# Configure TFLint version in mise.toml for CI integration tests.
mise.cicd.toml (1)

1-7: Lock CI tool versions for reproducibility.
Pinning versions for critical tools is excellent. One consideration: setting "go:golang.org/x/tools/cmd/goimports" = "latest" could introduce non-determinism. If strict reproducibility is required, you may want to specify an exact version.
Please also verify that these versions are in sync with the .github/scripts/setup/* scripts.

test/integration_units_reading_test.go (2)

1-2: Backward-compatible build tags.
You’ve added the //go:build sops directive. If this codebase supports Go versions <1.17, consider adding the legacy tag on the next line:

// +build sops

to maintain compatibility with older tooling.


29-29: Align file naming with test content.
Renaming the function to TestSOPSUnitsReading clarifies that it’s a SOPS‐specific test. For consistency, you may want to rename the file to integration_sops_units_reading_test.go, matching other SOPS test filenames.

internal/cas/race_test.go (1)

46-63: Consider enhancing test validations.

While the test correctly verifies that no errors occur during the get operation and that the destination matches, consider adding more assertions to verify the fetched repository structure (e.g., checking for specific files or directories).

 			assert.Equal(t, tmpDir, res.Dst)
+			
+			// Verify that essential files were fetched correctly
+			essentialFiles := []string{".github", "go.mod", "README.md"}
+			for _, file := range essentialFiles {
+				assert.FileExists(t, filepath.Join(tmpDir, file))
+			}
.github/workflows/integration-test.yml (5)

90-119: Double-quote matrix expansions in the secrets-generation script.
Unquoted expansions can lead to word splitting or globbing. Please update as follows:

- for SECRET in ${{ join(matrix.integration.secrets, ' ') }}; do
+ for SECRET in "${{ join(matrix.integration.secrets, ' ') }}"; do

Also quote the redirect path:

- echo "export SCRIPT_PATHS='${{ matrix.integration.setup_scripts }}'" > $ENV_FILE
+ echo "export SCRIPT_PATHS='${{ matrix.integration.setup_scripts }}'" > "$ENV_FILE"
🧰 Tools
🪛 actionlint (1.7.4)

92-92: shellcheck reported issue in this script: SC2086:info:2:72: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:7:78: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:9:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:11:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:13:86: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:14:95: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:16:90: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:18:88: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:20:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:22:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 YAMLlint (1.35.1)

[error] 95-95: trailing spaces

(trailing-spaces)


95-95: Remove trailing whitespace.
Lines 95 and 125 contain trailing spaces, which cause YAML lint errors. Please delete the extra spaces at the end of those lines.

Also applies to: 125-125

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 95-95: trailing spaces

(trailing-spaces)


121-134: Quote script path expansions in the Setup step.
To guard against splitting if a path contains spaces, wrap the expansion in quotes:

- for SCRIPT in ${{ join(matrix.integration.setup_scripts, ' ') }}; do
+ for SCRIPT in "${{ join(matrix.integration.setup_scripts, ' ') }}"; do
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 125-125: trailing spaces

(trailing-spaces)


155-164: Quote go test arguments for stability.
Ensure TAGS and RUN parameters are passed intact even if they include special characters:

- go test -v ${TAGS:+-tags "$TAGS"} ${RUN:+-run "$RUN"} "${TARGET}"
+ go test -v ${TAGS:+-tags "${TAGS}"} ${RUN:+-run "${RUN}"} "${TARGET}"

90-134: Consider using $GITHUB_ENV over a custom .env.secrets file.
Writing secrets directly to $GITHUB_ENV is more idiomatic and auto-injects them into subsequent steps, removing the need to source a separate file:

- echo "export AWS_ACCESS_KEY_ID='${{ secrets.AWS_ACCESS_KEY_ID }}'" >> $ENV_FILE
+ echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV
🧰 Tools
🪛 actionlint (1.7.4)

92-92: shellcheck reported issue in this script: SC2086:info:2:72: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:7:78: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:9:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:11:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:13:86: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:14:95: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:16:90: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:18:88: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:20:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:22:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 YAMLlint (1.35.1)

[error] 95-95: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83e41ca and 2407f3d.

📒 Files selected for processing (21)
  • .circleci/config.yml (0 hunks)
  • .github/scripts/setup/aws.sh (1 hunks)
  • .github/scripts/setup/engine.sh (1 hunks)
  • .github/scripts/setup/gcp.sh (1 hunks)
  • .github/scripts/setup/sops.sh (1 hunks)
  • .github/scripts/setup/ssh.sh (1 hunks)
  • .github/scripts/setup/tflint.sh (1 hunks)
  • .github/workflows/base-test.yml (3 hunks)
  • .github/workflows/build-no-proxy.yml (0 hunks)
  • .github/workflows/integration-test.yml (1 hunks)
  • .github/workflows/precommit.yml (1 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • internal/cas/getter_ssh_test.go (2 hunks)
  • internal/cas/git.go (2 hunks)
  • internal/cas/race_test.go (1 hunks)
  • mise.cicd.toml (1 hunks)
  • test/fixtures/download/remote-ref/terragrunt.hcl (1 hunks)
  • test/fixtures/source-map/slashes-in-ref/terragrunt.hcl (1 hunks)
  • test/integration_sops_test.go (4 hunks)
  • test/integration_tflint_test.go (2 hunks)
  • test/integration_units_reading_test.go (1 hunks)
💤 Files with no reviewable changes (2)
  • .github/workflows/build-no-proxy.yml
  • .circleci/config.yml
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.

**/*.go: Review the Go code for quality and correctness. Make sure that the Go code follows best practices, is performant, and is easy to understand and maintain.

  • internal/cas/getter_ssh_test.go
  • test/integration_units_reading_test.go
  • internal/cas/git.go
  • internal/cas/race_test.go
  • test/integration_tflint_test.go
  • test/integration_sops_test.go
🧬 Code Graph Analysis (1)
test/integration_sops_test.go (2)
test/helpers/package.go (5)
  • CleanupTerraformFolder (719-726)
  • CopyEnvironment (83-96)
  • RunTerragrunt (799-803)
  • RunTerragruntCommandWithOutput (827-831)
  • TerraformOutput (77-81)
util/file.go (1)
  • JoinPath (472-474)
🪛 actionlint (1.7.4)
.github/workflows/precommit.yml

38-38: property "os" is not defined in object type {}

(expression)


43-43: property "os" is not defined in object type {}

(expression)


44-44: property "arch" is not defined in object type {}

(expression)

.github/workflows/integration-test.yml

92-92: shellcheck reported issue in this script: SC2086:info:2:72: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:7:78: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:9:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:11:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:13:86: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:14:95: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:16:90: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:18:88: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:20:92: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: shellcheck reported issue in this script: SC2086:info:22:84: Double quote to prevent globbing and word splitting

(shellcheck)


92-92: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 YAMLlint (1.35.1)
.github/workflows/integration-test.yml

[error] 95-95: trailing spaces

(trailing-spaces)


[error] 125-125: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test (macos)
  • GitHub Check: Pull Request has non-contributor approval
🔇 Additional comments (32)
.pre-commit-config.yaml (2)

3-3: Approve version bump.
Bumping the rev to v0.1.29 aligns with the new GHA workflow and ensures you pick up the latest fixes.


5-6:

Details

✅ Verification successful

Verify the new hook exists in the updated revision.
Ensure that the tofu-fmt hook is available in the v0.1.29 revision of the gruntwork-io/pre-commit repo.


🏁 Script executed:

#!/bin/bash
# Verify that `tofu-fmt` is defined in the hooks manifest at rev v0.1.29
curl -sL https://raw.githubusercontent.com/gruntwork-io/pre-commit/v0.1.29/.pre-commit-hooks.yaml | grep -A2 'id: tofu-fmt'

Length of output: 240


tofu-fmt hook confirmed in v0.1.29
The tofu-fmt hook is defined in the gruntwork-io/pre-commit repo at revision v0.1.29, matching your .pre-commit-config.yaml entry. No further action required.

test/fixtures/source-map/slashes-in-ref/terragrunt.hcl (1)

2-2:

Details

✅ Verification successful

Ensure test fixture path correctness.
The source now points to hello-world-no-remote, which matches the updated fixture path. Please verify that the directory test/fixtures/download/hello-world-no-remote exists and contains the expected Terraform module for this integration test.
Run the following to confirm:


🏁 Script executed:

#!/bin/bash
fd hello-world-no-remote test/fixtures/download

Length of output: 95


Verified fixture path
The directory test/fixtures/download/hello-world-no-remote/ exists as expected. No further action needed.

test/fixtures/download/remote-ref/terragrunt.hcl (1)

6-6:

Details

✅ Verification successful

Confirm Git reference and path.
The updated source URL includes hello-world-no-remote and ?ref=v0.77.22. Verify that the tag v0.77.22 exists in the gruntwork-io/terragrunt repository and that the path test/fixtures/download/hello-world-no-remote is present in that revision.


🏁 Script executed:

#!/bin/bash
git ls-remote --tags git@github.com:gruntwork-io/terragrunt.git | grep 'refs/tags/v0.77.22'

Length of output: 162


To verify both the tag and the path, let’s try over HTTPS and then shallow-clone that revision to check the directory:


🏁 Script executed:

#!/bin/bash
# Check that tag v0.77.22 exists
git ls-remote --tags https://github.com/gruntwork-io/terragrunt.git | grep 'refs/tags/v0.77.22'
# Shallow-clone just that tag and verify the fixture path
git clone --depth 1 --branch v0.77.22 https://github.com/gruntwork-io/terragrunt.git temp-repo
if [ -d temp-repo/test/fixtures/download/hello-world-no-remote ]; then
  echo "PATH_EXISTS"
else
  echo "PATH_MISSING"
fi

Length of output: 1021


Git tag and source path verified

  • Tag v0.77.22 exists in the gruntwork-io/terragrunt repo.
  • Directory test/fixtures/download/hello-world-no-remote is present at that revision.

No further changes needed.

.github/scripts/setup/tflint.sh (2)

3-3: Enable strict error handling.
Great use of set -euo pipefail to ensure failures are caught early.


5-5: Pin TFLint version in CI configuration.
Appending tflint = "0.47.0" ensures consistency with the integration-test workflow matrix entry. Confirm alignment with other tool versions in mise.cicd.toml.

.github/scripts/setup/ssh.sh (1)

1-9: Good implementation of the SSH setup script.

This script properly sets up SSH by:

  1. Using appropriate error handling with set -euo pipefail
  2. Validating the required environment variable
  3. Setting correct permissions (600) for the private key

The script follows shell scripting best practices and security standards for handling SSH keys.

test/integration_tflint_test.go (2)

132-132: Function rename for consistent test naming conventions.

The function has been properly renamed from TestExternalTflint to TestTflintExternalTflint to follow a consistent naming pattern, which improves test organization and discoverability.


148-148: Function rename for consistent test naming conventions.

The function has been properly renamed from TestTfvarsArePassedToTflint to TestTflintTfvarsArePassedToTflint to follow a consistent naming pattern, which improves test organization and discoverability.

internal/cas/getter_ssh_test.go (2)

14-14: Added import for filepath package.

The import is properly added to support the new changes in the test.


50-61: Improved test isolation by scoping resources to each subtest.

This change enhances test reliability by:

  1. Moving the CAS client initialization inside the subtest loop
  2. Creating a unique store path for each test
  3. Properly scoping all resources (client, options, logger, getter) to each subtest

These changes prevent potential cross-test interference and improve parallel test execution reliability.

internal/cas/git.go (2)

10-11: Added required imports for timestamp generation.

The imports for strconv and time are correctly added to support the timestamp functionality.

Also applies to: 12-13


148-153: Enhanced temporary directory naming with timestamps.

This is an excellent improvement that:

  1. Reduces the likelihood of directory name collisions in concurrent environments
  2. Uses nanosecond precision for high uniqueness
  3. Maintains backward compatibility with the existing function signature

This change will help prevent race conditions when running tests in parallel.

.github/workflows/base-test.yml (5)

18-19: LGTM! Environment setup for CI/CD.

Setting up a specific mise profile for CI/CD is a good practice to ensure consistent tooling environments.


29-29: LGTM! Enabling experimental features.

Enabling experimental features in mise-action will allow access to newer features that might be beneficial for CI/CD workflows.


53-56: Great improvement to test result handling!

The changes properly capture test output in multiple formats:

  1. Setting pipefail ensures command failures are properly propagated
  2. Using go-junit-report generates structured test results
  3. Preserving raw logs while also creating XML reports

This approach significantly improves test result visibility and debugging capabilities.


62-67: LGTM! Artifact upload.

Uploading test reports as artifacts makes them easily accessible for later analysis, which is particularly helpful for debugging test failures.


68-75: Great addition of structured test reporting!

Using action-junit-report provides a well-formatted, easily readable summary of test results directly in the GitHub Actions UI. The configuration options for detailed summaries and time inclusion will make test failures much easier to diagnose.

internal/cas/race_test.go (3)

1-14: LGTM! Well-structured test file setup.

The file is properly organized with clear package declaration, imports, and documentation. Using the cas_test package (rather than cas) follows Go best practices for testing.


16-32: Good parallel test configuration with proper resource initialization.

The test is correctly set up to run in parallel with t.Parallel() and initializes the CAS instance and getter client properly. The setup correctly creates isolated resources for concurrent testing.


33-44: Good use of table-driven testing pattern.

The table-driven test approach makes it easy to add more test cases in the future, improving maintainability.

.github/workflows/precommit.yml (1)

1-29: LGTM! Well-structured workflow setup.

The workflow is properly configured to run on appropriate events and includes necessary setup steps for tooling and dependencies.

test/integration_sops_test.go (7)

32-32: LGTM! Standardized test naming.

Standardizing test names with uppercase "SOPS" improves consistency across the test suite.


65-65: LGTM! Standardized test naming.

Consistently applying the "SOPS" capitalization pattern across test functions.


72-73: LGTM! Updated command format.

The command now properly uses the --queue-include-dir parameter to target specific directories in the run-all operation.


74-74: LGTM! Updated command format with improved output handling.

The command format is updated to match line 72, and the function now returns the output directly for processing.


78-78: LGTM! Direct string unmarshaling.

The code now directly unmarshals from the stdout string rather than converting to bytes first, which is cleaner.


95-95: LGTM! Standardized test naming.

Test name updated to maintain consistent capitalization of "SOPS".


111-111: LGTM! Standardized test naming.

Test name updated to maintain consistent capitalization of "SOPS".

.github/workflows/integration-test.yml (3)

1-9: Triggers configuration looks correct and comprehensive.
The workflow fires on pushes to main and pull request events (opened, synchronize, reopened), which aligns with the intended integration test coverage.


10-18: Matrix strategy with fail-fast: false is appropriate for full feedback.
Allowing all matrix jobs to run even if one fails ensures you get complete insight into each integration scenario.


19-85: Integration matrix entries are well-structured.
Each suite clearly defines its name, target, optional setup_scripts, tags, run filters, and required secrets. The use of skip: true for credentialed tests avoids CI failures when secrets aren’t provided.

Comment on lines +30 to +38
- id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"

- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix matrix references in cache key.

The cache key references matrix.os and matrix.arch, but there's no matrix strategy defined in this workflow.

-          key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
+          key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
- name: Go Build Cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
🧰 Tools
🪛 actionlint (1.7.4)

38-38: property "os" is not defined in object type {}

(expression)

Comment on lines +40 to +47
- name: Run pre-commit hooks
env:
GOPROXY: direct
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
pre-commit install
pre-commit run --all-files
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix matrix references in environment variables.

The environment variables reference matrix.os and matrix.arch, but there's no matrix strategy defined in this workflow.

       env:
         GOPROXY: direct
-        GOOS: ${{ matrix.os }}
-        GOARCH: ${{ matrix.arch }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run pre-commit hooks
env:
GOPROXY: direct
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
pre-commit install
pre-commit run --all-files
- name: Run pre-commit hooks
env:
GOPROXY: direct
run: |
pre-commit install
pre-commit run --all-files
🧰 Tools
🪛 actionlint (1.7.4)

43-43: property "os" is not defined in object type {}

(expression)


44-44: property "arch" is not defined in object type {}

(expression)

Copy link
Copy Markdown
Collaborator Author

@yhakbar yhakbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denis256 the only thing that's blocking is the workflow stuff. We need to fix that before we can merge. Once that's resolved, please approve the PR yourself so that I can merge it.

id: generate-secrets
run: |
ENV_FILE="${GITHUB_WORKSPACE}/.env.secrets"
echo "export SCRIPT_PATHS='${{ matrix.integration.setup_scripts }}'" > $ENV_FILE
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never directly interpolate these in the workflow. Please forward this through an env to avoid attacks involving shell injection.

source "${GITHUB_WORKSPACE}/.env.secrets"

# Loop through setup scripts and execute them
for SCRIPT in ${{ join(matrix.integration.setup_scripts, ' ') }}; do
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to forward this through an env var as well.

source "${GITHUB_WORKSPACE}/.env.secrets"
go test -v ${TAGS:+-tags "$TAGS"} ${RUN:+-run "$RUN"} "${TARGET}"
else
echo "Skipping tests for ${{ matrix.integration.name }} as the skip flag is true."
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to forward this through an env var as well.

pre-commit = "4.2.0"
gcloud = "520.0.0"
awscli = "2.27.7"
"go:golang.org/x/tools/cmd/goimports" = "latest"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool. I had no idea you could do this.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.github/workflows/integration-test.yml (1)

86-94: 🛠️ Refactor suggestion

Avoid direct interpolation of matrix variables in the shell script.
Past reviews flagged direct usage of ${{ matrix.integration.setup_scripts }} and ${{ matrix.integration.secrets }} inside the run block due to potential injection risks and Actionlint errors (evaluating an array in a template). Instead, define these values under env: and reference them as shell variables:

 id: generate-secrets
+env:
+  SCRIPT_PATHS: ${{ join(matrix.integration.setup_scripts, ' ') }}
+  SECRET_LIST: ${{ join(matrix.integration.secrets, ' ') }}
 run: |
   ENV_FILE="${GITHUB_WORKSPACE}/.env.secrets"
-  echo "export SCRIPT_PATHS='${{ matrix.integration.setup_scripts }}'" > $ENV_FILE
+  echo "export SCRIPT_PATHS='$SCRIPT_PATHS'" > $ENV_FILE
   # Manually export each secret listed in matrix.integration.secrets
-  for SECRET in ${{ join(matrix.integration.secrets, ' ') }}; do
+  for SECRET in $SECRET_LIST; do
     ...

This also resolves the Actionlint complaint about evaluating an array directly in the template.

🧰 Tools
🪛 actionlint (1.7.4)

88-88: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 YAMLlint (1.35.1)

[error] 91-91: trailing spaces

(trailing-spaces)

🧹 Nitpick comments (1)
.github/workflows/integration-test.yml (1)

91-91: Remove trailing whitespace.
YAMLlint flags trailing spaces on these blank lines. Please delete the extra spaces to satisfy lint rules.

Also applies to: 121-121

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 91-91: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2407f3d and 26f2f73.

📒 Files selected for processing (3)
  • .github/workflows/base-test.yml (3 hunks)
  • .github/workflows/integration-test.yml (1 hunks)
  • mise.cicd.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • mise.cicd.toml
  • .github/workflows/base-test.yml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/integration-test.yml

88-88: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 YAMLlint (1.35.1)
.github/workflows/integration-test.yml

[error] 91-91: trailing spaces

(trailing-spaces)


[error] 121-121: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test (macos)
  • GitHub Check: Test (ubuntu)
  • GitHub Check: Pull Request has non-contributor approval
  • GitHub Check: build-and-test
🔇 Additional comments (3)
.github/workflows/integration-test.yml (3)

1-8: Workflow triggers look correct.
The on section properly configures the workflow to run on pushes to main and on pull request events (opened, synchronize, reopened).


16-24: Matrix strategy is well-defined.
Using fail-fast: false ensures all jobs run even if one fails, and defining multiple integration categories (Fixtures, SSH, SOPS, etc.) in the matrix is a clean way to parallelize.


150-158: Run Tests step with conditional skipping is solid.
The use of the skip flag to selectively bypass tests is correctly implemented, and re‐sourcing the secrets file before executing go test ensures proper environment setup.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26f2f73 and 8a92977.

📒 Files selected for processing (3)
  • .github/scripts/setup/generate-secrets.sh (1 hunks)
  • .github/scripts/setup/run-setup-scripts.sh (1 hunks)
  • .github/workflows/integration-test.yml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/scripts/setup/run-setup-scripts.sh
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/integration-test.yml

91-91: object, array, and null values should not be evaluated in template with ${{ }} but evaluating the value of type array

(expression)

🪛 GitHub Actions: Integration Tests
.github/workflows/integration-test.yml

[error] 91-91: The template is not valid. A sequence was not expected at line 91, column 25.

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test (ubuntu)
  • GitHub Check: Test (macos)
  • GitHub Check: build-and-test
  • GitHub Check: Pull Request has non-contributor approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants