Skip to content

Commit 6ea76b1

Browse files
docs(contributing): Add guide for running CI tests locally with tox-lsr
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
1 parent 8babd71 commit 6ea76b1

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

contributing.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,55 @@ explanation about the NetworkManager API.
118118
podman stop lsr-ci-c7
119119
podman rm lsr-ci-c7
120120
```
121+
122+
## Running CI Tests Locally
123+
124+
### Use tox-lsr with qemu
125+
126+
The latest version of tox-lsr supports qemu testing.
127+
<https://github.com/linux-system-roles/tox-lsr#qemu-testing>
128+
129+
**Steps:**
130+
131+
1. If you are using RHEL or CentOS, enable the EPEL repository for your
132+
platform - <https://docs.fedoraproject.org/en-US/epel/>
133+
134+
2. Use yum or dnf to install `standard-test-roles-inventory-qemu`
135+
* If for some reason dnf/yum do not work, just download the script from
136+
<https://pagure.io/standard-test-roles/raw/master/f/inventory/standard-inventory-qcow2>
137+
* copy to your `$PATH`, and make sure it is executable
138+
139+
3. Install tox
140+
* Use yum/dnf to install `python3-tox` - if that does not work, then use
141+
`pip install --user tox`, then make sure `~/.local/bin` is in your `$PATH`
142+
143+
4. Install tox-lsr <https://github.com/linux-system-roles/tox-lsr#how-to-get-it>
144+
145+
```bash
146+
pip install --user git+https://github.com/linux-system-roles/tox-lsr@main
147+
```
148+
149+
5. Download the config file to `~/.config/linux-system-roles.json` from
150+
<https://gitlab.cee.redhat.com/rhel-system-roles/resources/-/raw/main/linux-system-roles.json>
151+
* If you want to make changes to the config, file a merge request at
152+
<https://gitlab.cee.redhat.com/rhel-system-roles/resources>
153+
154+
**WARNING:** Do not put secrets such as passwords, tokens, keys, etc. in
155+
linux-system-roles.json - that should go into bitwarden.
156+
157+
6. Assuming you are in a git clone of a role repo which has a tox.ini file -
158+
you can use e.g.
159+
160+
```bash
161+
tox -e qemu-ansible-core-2.14 -- --image-name centos-9 tests/tests_default.yml
162+
```
163+
164+
There are many command line options and environment variables which can be used
165+
to control the behavior, and you can customize the testenv in tox.ini. See
166+
<https://github.com/linux-system-roles/tox-lsr#qemu-testing>
167+
168+
This method supports RHEL also - will download the latest image for a compose,
169+
and will set up the yum repos to point to internal composes.
170+
171+
See <https://linux-system-roles.github.io/contribute.html> for general
172+
development guidelines.

0 commit comments

Comments
 (0)