pre-commit-terraform icon indicating copy to clipboard operation
pre-commit-terraform copied to clipboard

Add integration tests for Docker images

Open MaxymVlasov opened this issue 2 years ago β€’ 0 comments

What problem are you facing?

At the start of April 2022 git released a new non-major version that includes a new check, that fails pre-commit-terraform runtime (#370) I'd like to not pin minor and patch versions of deps to avoid extra maintenance and security issues. At the same time, something can happen with deps, and we got a runtime error. So, we need to run runtime tests.

How I see the realization of integration tests:

  1. That should be a part of build-image-test.yaml pipeline.
  2. Need to add steps that go inside the build image and do the next things: 2.1. git clone repo with pre-commit-terraform test cases (subdir in tests/, in future, can be moved to separate repo) 2.2. Prepare to run pre-commit: cd pre-commit-terraform/tests, rm -rf ../.git, git init, git add -A 2.3. For each hook: Run pre-commit run -a HOOK_NAME and check that the output result is the same as expected.
    I suppose that it can be done via bats-core (check #303 for additional info)

So, from text above, we need to:

  1. Add terraform code (valid and not) that we will test
  2. Add tests, that will check that pre-commit run -a HOOK_NAME output is OK

MaxymVlasov avatar Apr 20 '22 13:04 MaxymVlasov