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

Run unit tests using multiple configurations #1903

Merged
merged 33 commits into from
Jul 29, 2024

Conversation

andrewleith
Copy link
Member

@andrewleith andrewleith commented Jul 23, 2024

Summary | Résumé

Background

Recently we've had some issues with bugs popping up due to feature flags. While development is ongoing in staging with a particular feature flag on, it is easy to miss ensuring everything will still work in PROD while the feature flag remains off. The idea of this PR is to run our unit tests twice on each PR when feature flag settings differ between staging and prod

Changes

This PR adds support to run 2 instances of our unit tests, in parallel.

By default, our unit tests run using NOTIFY_ENVIRONMENT=test which is provided by pytest.ini. The test workflow has been duplicated and modified to run the unit tests using an alternative value for NOTIFY_ENVIRONMENT.

A new config section for mimicking prod's feature flag configuration has been created, and the existing Test config has been updated to have the same feature flags set as staging does.

Copy link

… second time

- updates `pytest.ini` to set `NOTIFY_ENVIRONMENT` = 'production' when running the tests
- update the 'production' config to use the same feature flags as prod does right now
- update the 'test' config to use the same feature flags as staging does right now
@andrewleith andrewleith changed the title Feat/run tests without ffs Run unit tests using multiple configurations Jul 24, 2024
app/config.py Fixed Show fixed Hide fixed
app/config.py Fixed Show fixed Hide fixed
app/config.py Fixed Show fixed Hide fixed
@andrewleith andrewleith marked this pull request as ready for review July 24, 2024 17:08
Comment on lines +39 to +40
- name: Update NOTIFY_ENVIRONMENT for pytest
run: sed -i 's/NOTIFY_ENVIRONMENT=test/NOTIFY_ENVIRONMENT=production_FF/' pytest.ini
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only difference between the original workflow and the new one. Not sure if we can make these re-usable somehow and not have to copy them.

@andrewleith andrewleith merged commit ab8b822 into main Jul 29, 2024
10 checks passed
@andrewleith andrewleith deleted the feat/run-tests-without-ffs branch July 29, 2024 20:53
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.

3 participants