Skip to content

Commit

Permalink
CONTRIBUTING: Add a note on re-generating mock test data for unit tests
Browse files Browse the repository at this point in the history
We've lacked any kind of mention of the hack directory and its purpose.

Signed-off-by: Erik Skultety <[email protected]>
  • Loading branch information
eskultety committed Jan 6, 2025
1 parent f29bc0c commit 655d51a
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,26 @@ nox -s python-3.9 -- tests/unit/extras/test_envfile.py::test_cannot_determine_fo

In short, nox passes all arguments to the right of `--` directly to pytest.

#### Generating new test data

Whenever a particular package manager supported version is bumped it is considered good practice
to also re-generate the mocked unit test data using that version of package manager (make sure you
have it available in path). You do that by executing the corresponding script under
`hack/mock-unittest-data`. Note that there may be times the data has to be re-generated even
without bumping the backend version, e.g. we added support for a particular feature of the package
manager which we didn't add at the time of the initial support release.

Example:
```shell
hack/mock-unittest-data/gomod.sh
```

Generate data for test cases matching a pytest pattern:

```shell
nox -s generate-test-data -- -k test_e2e_gomod
```

### Running integration tests

Build Cachi2 image (localhost/cachi2:latest) and run most integration tests:
Expand All @@ -229,7 +249,7 @@ CACHI2_IMAGE=quay.io/konflux-ci/cachi2:{tag} nox -s integration-tests
CACHI2_IMAGE=localhost/cachi2:latest nox -s integration-tests
```

#### Running integration tests and generating new test data
#### Generating new test data

To re-generate new data (output, dependencies checksums, vendor checksums) and run integration tests with them:

Expand Down

0 comments on commit 655d51a

Please sign in to comment.