antonbabenko / pre-commit-terraform

pre-commit git hooks to take care of Terraform configurations 🇺🇦
MIT License
3.17k stars 536 forks source link

Add unit-tests that will found problems with new code #303

Open MaxymVlasov opened 2 years ago

MaxymVlasov commented 2 years ago

What problem are you facing?

New PR's time to time break existing functional, and that can't be found by PR review. Here one of the examples why we should test corner cases on PR's: https://github.com/antonbabenko/pre-commit-terraform/pull/302

Try to use https://github.com/bach-sh/bach Reason: https://github.com/antonbabenko/pre-commit-terraform/pull/252#issuecomment-951414283 Or https://github.com/bats-core/bats-core

MaxymVlasov commented 2 years ago

Tried bach - no idea how to test $ARGS value after common::parse_cmdline execution. Test just not go inside for-loop

Branch: https://github.com/antonbabenko/pre-commit-terraform/compare/chore/GH-303/add_unit_tests-BACH Commit: https://github.com/antonbabenko/pre-commit-terraform/commit/5e563bea26dfe5def1267910a5c891e44fb57ef9

MaxymVlasov commented 2 years ago

Need to check https://opensource.com/article/19/2/testing-bash-bats

MaxymVlasov commented 2 years ago

Go/Ruby https://github.com/cloudfoundry-incubator/kubo-deployment/tree/v0.14.0/src/kubo-deployment-tests

https://t.me/catops_chat/61258

MaxymVlasov commented 1 year ago

That works awesome https://github.com/kward/shunit2