pre-commit-terraform
pre-commit-terraform copied to clipboard
Add integration tests for Docker images
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:
- That should be a part of build-image-test.yaml pipeline.
- Need to add steps that go inside the build image and do the next things:
2.1.
git clonerepo withpre-commit-terraformtest cases (subdir intests/, 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 -A2.3. For each hook: Runpre-commit run -a HOOK_NAMEand check that the output result is the same as expected.
I suppose that it can be done viabats-core(check #303 for additional info)
So, from text above, we need to:
- Add terraform code (valid and not) that we will test
- Add tests, that will check that
pre-commit run -a HOOK_NAMEoutput is OK