|
| 1 | +# Python Extension Common (PEC) Developer Guide |
| 2 | + |
| 3 | +## Pytest Plugins |
| 4 | + |
| 5 | +PEC declares a dependency to pytest plugin `pytest-exasol-saas` which are maintained in GitHub repository [pytest-plugins/pytest_saas](https://github.com/exasol/pytest-plugins/tree/main/pytest-saas/). |
| 6 | + |
| 7 | +This plugin makes additional fixtures available that are used in the integration tests of PEC. |
| 8 | +See files in folder [test/integration](../tree/main/test/integration): |
| 9 | + |
| 10 | +* `conftest.py` |
| 11 | +* `test_language_container_deployer_saas.py` |
| 12 | +* `test_language_container_deployer_saas_cli.py` |
| 13 | + |
| 14 | +## Running Tests in CI Builds |
| 15 | + |
| 16 | +The test cases in PEC are separated in two groups. |
| 17 | + |
| 18 | +| Group | Execution | Name of gating GitHub workflow | |
| 19 | +|-----------------------------|-----------------------------------------|--------------------------------| |
| 20 | +| G1) Fast and cheap tests | On each push to your development branch | Gate 1 - Regular CI | |
| 21 | +| G2) Slow or expensive tests | Only on manual approval, see below | Gate 2 - Allow Merge | |
| 22 | + |
| 23 | +This enables fast development cycles while still protecting the main branch against build failures. |
| 24 | + |
| 25 | +For PEC group G2 particularly contains the tests involving Exasol SaaS infrastructure which are creating costs for the database instances temporarily created during test execution. |
| 26 | + |
| 27 | +Group G2 is guarded by a dedicated [GitHub Enviroment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#required-reviewers) requiring **manual approval** before these tests are executed. |
| 28 | + |
| 29 | +Each of the groups results in a final gating GitHub workflow job that is added to the branch protection of branch `main`. |
| 30 | + |
| 31 | +So in order to merge a branch to `main` branch, the tests of both groups need to be executed and to have terminated succesfully. |
| 32 | + |
| 33 | +### Approving Slow Tests |
| 34 | + |
| 35 | +To approve executing the tests in group G2 |
| 36 | +* Open your pull request in GitHub |
| 37 | +* Scroll to section "Checks" |
| 38 | +* Locate pending tasks, e.g. "Ask if Slow or Expensive Tests (e.g. SaaS) Should be Run" |
| 39 | +* Click the link "Details" on the right-hand side |
| 40 | +* Click "Review pending Deplopyments" |
| 41 | +* Select the checkbox "slow-tests" |
| 42 | +* Click the green button "Approve and deploy" |
0 commit comments