Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy func test fixtures code #4325

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

leohemsted
Copy link
Contributor

@leohemsted leohemsted commented Jan 2, 2025

objective:

split functional_test_fixtures into two concerns:

  • creating db fixtures and returning relevant variables
  • putting said variables into a file on disk/an ssm upload

rationale:

  • i want to be able to use these fixtures in a future PR to unit test the purge functional test fixture command
  • i want the unit tests for this function to be simpler and easier to debug

this is really really best viewed commit-by-commit

@leohemsted leohemsted force-pushed the tidy-func-test-fixtures-code branch 2 times, most recently from 3aecbeb to 555cb0e Compare January 2, 2025 15:22
enforces separation of concerns a bit, and will make the inner
function easier to test independently

i've tested this manually - the only differences between the old
env vars file and the new one are:

* new list is not ordered and doesn't have whitespace between sections
* new list wraps _everything_ in single quotes. This could be an issue
  if an environment variable contains a single quote itself!
one test for the outer function, ignoring all fixtures - only concerned
with "is the env var file well formed?" and "are things put in ssm
correctly?""

one test for the inner function, ignoring ssm/etc - concerned with "are
we creating db objects sensibly in an idempotent manner?" and "are we
returning the correct things for environment variables?"
the idempotency is more about making sure fixtures can be applied to the
same database multiple times
a bit cleaner and simpler than bit-by-bit string manipulation
@leohemsted leohemsted force-pushed the tidy-func-test-fixtures-code branch from 555cb0e to 77d2b68 Compare January 3, 2025 16:44
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