-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run unit tests using multiple configurations (#1903)
* set FF_TEMPLATE_CATEGORY on for testing * feat: add new workflow to run tests with ff OFF * task: update config on the fly to turn FF on; echo config.py contents * task: echo config.py contents before tests start * task: turn the FF back on in the config * fix: fix unrelated, failing test * fix: load production set of feature flags when running unit tests the 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 * chore: rename action * chore: update prod config * chore: formatting * fix: add more things to the prod config (taken from the Test config) * fix(debug): cat the `pytest.ini` instead of `config.py` * fix: try changing some configs * fix: tweak prod config again * chore: update workflow names, filename * debug: add a few more debug things * fix: put back configs im unsure of * fix: try doing these overrides in pytest.ini so they dont affect prod * fix: try unsetting these values * fix: try another thing * fix: add new config for running prod feature flags; revert production config * fix: use new config for 2nd unit test run * chore: formatting * test: force a test to fail when FF is OFF * chore: formatting * chore: remove debugging code * Update .github/workflows/test_prod_config.yaml
- Loading branch information
1 parent
0ca7f2d
commit ab8b822
Showing
3 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
on: | ||
push: | ||
schedule: | ||
- cron: '1 0-12,20-23 * * 1-5' | ||
- cron: '1 * * * 0,6' | ||
name: Continuous Integration Testing (prod feature flags) | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 | ||
with: | ||
node-version: '16.x' | ||
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install poetry | ||
env: | ||
POETRY_VERSION: "1.7.1" | ||
run: pip install poetry==${POETRY_VERSION} && poetry --version | ||
- name: Install requirements | ||
run: poetry install --with test | ||
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Check for missing translations | ||
run: make test-translations | ||
- name: Update NOTIFY_ENVIRONMENT for pytest | ||
run: sed -i 's/NOTIFY_ENVIRONMENT=test/NOTIFY_ENVIRONMENT=production_FF/' pytest.ini | ||
- run: /bin/bash -c "scripts/bootstrap.sh && poetry run make test" | ||
env: | ||
A11Y_TRACKER_KEY: ${{ secrets.A11Y_TRACKER_KEY }} | ||
MIXPANEL_PROJECT_TOKEN: <project_token> | ||
- name: Notify Slack channel if this job failed in default branch | ||
if: ${{ failure() && github.ref == 'refs/heads/main' }} | ||
run: | | ||
json="{'text':'<!here> CI is failing in <https://github.com/cds-snc/notification-admin/|notification-admin> !'}" | ||
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters