Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions tests/ci/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
# The requirements.txt file is just a placeholder to show the installed packages in the utility container
https://github.com/validatedpatterns/utility-container/blob/main/requirements.txt

# The ci will run pytest based on file pattern
pytest -lv test_<TARGET_CLUSTERGROUP>.py --junit-xml .results/test_<TARGET_CLUSTERGROUP>.xml

# To run upstream tests locally
Set the env variables pointing to the clusters needed to run the tests on:
```VP_HUBCONFIG``` (```VP_SPOKECONFIG``` if applicable) pointing to the kubconfig of hub (and spoke) clusters
(all VP_* env var will be available inside the container)
```TARGET_CLUSTERGROUP``` if its different from the default (values-global.yaml main.clusterGroupName)
Test logs and junit-xml will be saved in ci/.results/
Run from repo root
# CI Tests

The requirements.txt file is just a placeholder to show the installed packages in the utility container:
[utility-container requirements.txt](https://github.com/validatedpatterns/utility-container/blob/main/requirements.txt)

## The ci will run pytest based on file pattern

pytest -lv test\_\<TARGET_CLUSTERGROUP>.py --junit-xml .results/test\_\<TARGET_CLUSTERGROUP>.xml

## To run upstream tests locally

Set the env variables pointing to the clusters needed to run the tests on:\
`VP_HUBCONFIG` (`VP_SPOKECONFIG` if applicable) pointing to the kubconfig of hub (and spoke) clusters\
(all VP\_\* env var will be available inside the container)\
`TARGET_CLUSTERGROUP` if its different from the default (values-global.yaml main.clusterGroupName)\
Test logs and junit-xml will be saved in ci/.results/\
Run from root repository:

```bash
./pattern.sh make run-ci-tests
```

# Writing additonal tests
The openshift_dyn_client fixture will return a DynamicClient which can be used inside test functions.
It requires only an env variable param to use it as a kubeconfig.
## Writing additional tests

The openshift_dyn_client fixture will return a DynamicClient which can be used inside test functions.\
It requires only an env variable param to use it as a kubeconfig.

```python
@pytest.mark.parametrize(
"openshift_dyn_client",
["VP_HUBCONFIG"],
indirect=True,
)
```
If your tests requires additional python packages, you might want to either run them fully locally in a venv or similar.
Or if you want to use the pattern framework (make/ansible wrappers) you need to use your own util container

If your tests requires additional python packages, you might want to either run them fully locally in a venv or similar.\
Or if you want to use the pattern framework (make/Ansible wrappers) you need to use your own util container

```bash
PATTERN_UTILITY_CONTAINER="your_utility container" ./pattern.sh make run-ci-tests

```
```
2 changes: 1 addition & 1 deletion tests/ci/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from validatedpatterns_tests.interop.conftest_openshift import *
from validatedpatterns_tests.interop.conftest_openshift import * # noqa: F401,F403
Loading