Hiya, I have a PR open here: <https://github.com/c...
# pr-reviews
m
Hiya, I have a PR open here: https://github.com/cloudposse/terraform-aws-waf/pull/118 for adding anti-DDS’s functionality, but I had a question about testing on the PR. (Also willing to wait for office hours if need be)
👀 1
❤️ 1
merged 1
b
Might be able to help, still reviewing the PR. What's your question on testing?
m
Ah so fast- thank you Ben! My question around testing is what’s the process to add explicit tests? I also see when I run the make test command I get a bunch of “module not installed” errors that indicates I messed something up
b
Gotcha, lemme see what
make test
is doing in this repo, we've had a change of tests (relatively) recently.
the newer tests are ran using a comment
/terratest
👀 1
m
Also this is not pressing at all, as it is already late East coast hours. Just really appreciate all the work yall do and wanted to try and help out with a newer AWS feature we are using
b
Appreciate the PR, open source PRs help us out a ton! and no problem, was doing some late night coding. so tests run via
/terratest
they essentially run
go test -v
behind the scenes. this will run the component.go test. Typically theres a suite that can vendor in dependencies before hand (usually account-map is the problem) This module looks to be a bit older. It's missing some of the Go setup, and were deprecating make files.
Just saw your comment on GitHub, so I can either respond there or here, or both. Usually tests are run through TerraTest comment. This will run the GoTest, and the GoTest runs based on fixtures (which is based on our stacks), and that allows us to easily define multiple instances or iterations of the component. You can also enhance it with GoTesting, of course.
Make init
and
make readme
are two commands that we're deprecating as well. I'll need to verify that there's no other files that need to be added. These are being replaced with
Atmos Docs Generate Readme
. (Sorry for capitalization. I'm using speech-to-text.) We also normally have a workflow that generates the README for you, so if you make changes, it'll just generate it on the next commit in your PR. Let me talk with a colleague in the morning on the various files and setup. We should be able to copy it from another component and kind of just throw it in. But we can update this repo in another PR, and then this might make your PR a little bit easier.
m
Ok yeah sounds good! Looks also like the AI came up with a few suggestions I’ll add in, so we can reconvene when you hear back from folks about things. have a great night!
b
Take the copilot suggestions with a grain of salt - I just use it because it's sometimes hard to read all the nested dot syntaxes - they might not be right 🙂
https://docs.cloudposse.com/community/contribute/component-testing/ it looks like the makefile in the root of the repository was replaced with the atmos.yaml, which is great—that means readme generation is actually supported. don't know how i missed that last night.
atmos docs generate readme
is the command to update the readme from the
readme.yaml
.
pre-commit
is used to ensure terraform stuff is up-to-date, formatting, lints. the structure of this repo is a little bit different from the rest of the repos, but that's fine. so the fixtures folder is the test—along with the surrounding Terraform code and VARS file that'll be applied. so the test you have modified is correct, but now there's an issue with the actual configuration of it. looks like Terraform test failed with some invalid configuration.
m
ah thank you, running
go test -v -timeout 1h
from the test/src directory was failing - I have updated and it is passing now! thanks for all your assistance & guidance here
looks like the tests passed! 🥳 - is there anything else I need to do here?
b
Let me do one last review, and we can merge this in, thanks for the PR!
🍌 1
m
thank you so much ben! I have other PRs queued also here but def take your time aws