Skip to content

Commit 8a3ff2f

Browse files
authored
Update external docs
1 parent 85c8139 commit 8a3ff2f

File tree

4 files changed

+125
-45
lines changed

4 files changed

+125
-45
lines changed

external/bots/README.md

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ When generating a new personal access token, the scopes should contain
9090
`repo:status` and `read:org`. Note in particular, that `repo` and
9191
`public_repo` scopes each grant full push access, and should not be used.
9292

93+
You need at least "Write" access to the project for triggering statuses, either
94+
individually per repo (e.g. [cockpit](https://github.com/cockpit-project/cockpit/settings/access)
95+
or for [all cockpit-project repos](https://github.com/orgs/cockpit-project/teams/committers).
96+
9397
If you'd like to download Red Hat-only internal images from S3, you'll
9498
need to create a key file in `~/.config/cockpit-dev/s3-keys/[domain]`.
9599
The `[domain]` can be any non-toplevel domain which contains the S3 URL
@@ -124,7 +128,7 @@ For describing tests which we want to run we use __contexts__. A context has the
124128
image[/scenario][@bots#bots_pr][@owner/project/ref]
125129

126130
where items have the following meaning:
127-
- image: Name of the image on which tests should run (e.g. 'fedora-testing').
131+
- image: Name of the image on which tests should run (e.g. 'fedora-coreos').
128132
- scenario: Name of a specific test. This is specific for each separate project and
129133
is passed verbatim to 'test/run' in `$TEST_SCENARIO`.
130134
- bots_pr: Number of pull request that exists in bots repository. When specified,
@@ -134,28 +138,28 @@ where items have the following meaning:
134138
- ref: Reference in the project (usually branch) (e.g. 'rhel-8.2'). Default is
135139
the project's primary branch.
136140

137-
For example, context for scenario 'firefox' on 'fedora-testing' is:
141+
For example, context for scenario 'firefox' on 'fedora-coreos' is:
138142

139-
fedora-testing/firefox
143+
fedora-coreos/firefox
140144

141145
If we want to trigger it on 'cockpit-project/cockpit':
142146

143-
fedora-testing/firefox@cockpit-project/cockpit
147+
fedora-coreos/firefox@cockpit-project/cockpit
144148

145149
If we want to also not run it on the primary branch, but on 'rhel-8-0' branch:
146150

147-
fedora-testing/firefox@cockpit-project/cockpit/rhel-8-0
151+
fedora-coreos/firefox@cockpit-project/cockpit/rhel-8-0
148152

149-
If we want to run tests on 'fedora-testing' but with bots from pull request '169':
153+
If we want to run tests on 'fedora-coreos' but with bots from pull request '169':
150154

151-
fedora-testing@bots#169
155+
fedora-coreos@bots#169
152156

153157
### Retrying a failed test
154158

155-
If you want to run the "fedora-testing" testsuite again for pull
159+
If you want to run the "fedora-coreos" testsuite again for pull
156160
request #1234 of cockpit-project/cockpit, run tests-trigger like so:
157161

158-
./tests-trigger --repo cockpit-project/cockpit 1234 fedora-testing
162+
./tests-trigger --repo cockpit-project/cockpit 1234 fedora-coreos
159163

160164
You can also invoke bots/tests/trigger from any project checkout, in which case
161165
you don't need the explicit `--repo` -- it will default to the GitHub origin of
@@ -165,7 +169,7 @@ the current directory's project.
165169

166170
If you want to run all tests on pull request #1234 that has been opened by
167171
someone who does not have push access to the repository nor isn't in the
168-
[Contributors team](https://github.com/orgs/cockpit-project/teams/contributors/members),
172+
[allowlist](https://github.com/cockpit-project/bots/blob/main/lib/allowlist.py)
169173
run tests-trigger with `--allow`:
170174

171175
./tests-trigger --allow [...]
@@ -186,21 +190,21 @@ tests-trigger reads the repo. This has to be set per cockpit project.
186190
Test images are refreshed automatically once per week, and even if the
187191
last refresh has failed, the machines wait one week before trying again.
188192

189-
If you want the machines to refresh the fedora-testing image immediately,
193+
If you want the machines to refresh the fedora-coreos image immediately,
190194
run image-trigger like so:
191195

192-
./image-trigger fedora-testing
196+
./image-trigger fedora-coreos
193197

194198
### Creating new images for a pull request
195199

196200
If as part of some new feature you need to change the content of some
197201
or all images, you can ask the machines to create those images.
198202

199-
If you want to have a new fedora-testing image for pull request #1234, add
203+
If you want to have a new fedora-coreos image for pull request #1234, add
200204
a bullet point to that pull request's description like so, and add the
201205
"bot" label to the pull request.
202206

203-
* [ ] image-refresh fedora-testing
207+
* [ ] image-refresh fedora-coreos
204208

205209
The machines will post comments to the pull request about their
206210
progress and at the end there will be links to commits with the new
@@ -215,21 +219,6 @@ used as default OS for test VMs.
215219
1. If this is a new image, add `_manual` test contexts for the new image to `lib/testmap.py`, and land that into `main`.
216220
2. Create a PR that updates `TEST_OS_DEFAULT` in `lib/constants.py`, and trigger all tests for that image there.
217221

218-
#### Fedora testing image
219-
220-
The `fedora-testing` image is a Fedora image with updates-testing enabled,
221-
the version of the image is determined by what the
222-
`fedora-testing.bootstrap` symlink points too.
223-
224-
To update the Fedora version used:
225-
226-
1. Update the `fedora-testing.bootstrap` symlink to the latest Fedora
227-
release.
228-
2. Update the naughty symlink `naughty/fedora-testing` to the latest
229-
Fedora release.
230-
3. Create a new PR and refresh the image.
231-
232-
233222
#### Fedora CoreOS
234223

235224
The Fedora CoreOS image is updated to a new Fedora release out of our

external/source/HACKING.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,42 @@ git submodules:
185185
Refer to the [testing README](test/README.md) for details on running the Cockpit
186186
integration tests locally.
187187

188-
## Testing the Python bridge
188+
## Python bridge
189189

190-
Cockpit currently has an experimental replacement for `cockpit-bridge`
191-
written in Python. It resides in `src/cockpit` with most of its rules in
192-
`src/Makefile.am`. This directory was chosen because it matches the standard
193-
so-called "src layout" convention for Python packages, where each package
194-
(`cockpit`) is a subdirectory of the `src` directory.
190+
Most distro releases now ship a replacement for the C bridge written in Python.
191+
It resides in `src/cockpit` with most of its rules in `src/Makefile.am`. This
192+
directory was chosen because it matches the standard so-called "src layout"
193+
convention for Python packages, where each package (`cockpit`) is a
194+
subdirectory of the `src` directory.
195+
196+
### Running the bridge
197+
198+
The Python bridge can be used interactively on a local machine:
199+
200+
PYTHONPATH=src python3 -m cockpit.bridge
201+
202+
To make it easy to test out channels without having to write out messages
203+
manually, `cockpit.misc.print` can be used:
204+
205+
PYTHONPATH=src python3 -m cockpit.misc.print open fslist1 path=/etc watch=False | PYTHONPATH=src python3 -m cockpit.bridge
206+
207+
These shell aliases might be useful when experimenting with the protocol:
208+
209+
alias cpy='PYTHONPATH=src python3 -m cockpit.bridge'
210+
alias cpf='PYTHONPATH=src python3 -m cockpit.misc.print'
211+
212+
When working with the Python bridge on test images, note that `RHEL/CentOS 8`,
213+
`debian-stable`, and `ubuntu-2204` still use the C bridge. So if you want to
214+
explicitly have the Python bridge on those images use:
215+
216+
./test/image-prepare --python
217+
218+
To enable debug logging in journal on a test image, you can pass `--debug` to
219+
`image-prepare`. This will set `COCKPIT_DEBUG=all` to `/etc/environment`, if
220+
you are only interested channel debug messages change `all` to
221+
`cockpit.channel`.
222+
223+
### Testing the Python bridge
195224

196225
There are a growing number of Python `unittest` tests being written to test
197226
parts of the new bridge code. You can run these with `make pytest` or

external/source/test/README.md

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ title: Integration Tests of Cockpit
33
source: https://github.com/cockpit-project/cockpit/blob/master/test/README.md
44
---
55

6-
This directory contains automated integration tests for Cockpit, and the support
7-
files for them.
6+
This directory contains automated integration tests for Cockpit, and the
7+
support files for them. The architecture of the automated integration tests is
8+
described in [ARCHITECTURE](./ARCHITECTURE.md)
89

910
To run the tests on Fedora, refer to the [HACKING](../HACKING.md) guide for
1011
installation of all of the necessary build and test dependencies. There's
@@ -87,10 +88,70 @@ ssh and web. See the "Helpful tips" section below.
8788

8889
## Pixel tests
8990

90-
The verify test suite contains ["pixel tests"]({{ site.baseurl }}/blog/pixel-testing.html).
91-
Make sure to create the test/reference submodule before running tests which contain pixel tests.
91+
Pixel tests in Cockpit ensure that updates of our dependencies or code changes
92+
don't break the UI: for example slight changes of layout, padding, color and
93+
everything which isn't easily spotted by a human. They also give us confidence
94+
that an update of our UI Framework doesn't introduce changes in how Cockpit
95+
looks.
9296

93-
* test/common/pixel-tests pull
97+
Pixel tests make a screenshot of a selector and compare it to a known good
98+
reference image. if there is a difference, the test fails and a pixel
99+
difference is shown.
100+
101+
This works as our tests run in the [cockpit/tasks container](https://quay.io/repository/cockpit/tasks)
102+
which pins the browser and font rendering so repeated runs provide the same
103+
pixels. To generate new pixels, this tasks container must be used; your own
104+
browser and font rendering software might generate different results. For more
105+
information read the ["introduction blog post"]({{ site.baseurl }}/blog/pixel-testing.html).
106+
107+
The test images are stored in a git submodule in the `test/reference` directory
108+
and be fetched with:
109+
110+
```sh
111+
./test/common/pixel-tests update
112+
```
113+
114+
As Cockpit tests under multiple distributions and it is not worth the effort to
115+
run pixel tests on every supported distribution we only run them for the
116+
image configured in `test/reference-image`.
117+
118+
Our tests call `Browser.assert_pixels` at interesting and strategic places.
119+
This assertion method requires at least a CSS selector and an image title.
120+
Pixel tests are generated in five layouts by default: desktop, medium, mobile,
121+
dark and rtl.
122+
123+
Take a screenshot of the content in `#detail-content`:
124+
```python
125+
browser.assert_pixels("#detail-content", "filesystem")
126+
```
127+
128+
Take a screenshot of the content in `#detail-content` and ignore all elements
129+
with a class `disk-stats` as they change per test run:
130+
```python
131+
browser.assert_pixels("#detail-content", "filesystem", ignore=[".disks-stats"])
132+
```
133+
134+
Take a screenshot of the content in `#detail-content` and skip it for a
135+
specific layout as it generates unstable pixels:
136+
```python
137+
browser.assert_pixels("#detail-content", "filesystem", skip_layouts=["rtl"])
138+
```
139+
140+
To update pixel tests, locally run the test in the current tasks container, or
141+
create a draft PR and let the tests run for `test/reference-image` and
142+
afterwards fetch the new pixels:
143+
144+
```
145+
./test/common/pixel-tests fetch "https://cockpit-logs.us-east-1.linodeobjects.com/<snip>/log.html"
146+
```
147+
148+
Finally, upload the new pixel tests and commit the newly generated submodule commit:
149+
```
150+
./test/common/pixel-tests push
151+
```
152+
153+
**Note** that you have to a part of the [Contributors group](https://github.com/orgs/cockpit-project/teams/contributors)
154+
to push pixel tests.
94155

95156
## Test Configuration
96157

@@ -100,17 +161,17 @@ You can set these environment variables to configure the test suite:
100161
"centos-8-stream"
101162
"debian-stable"
102163
"debian-testing"
103-
"fedora-37"
104164
"fedora-38"
165+
"fedora-39"
105166
"fedora-coreos"
106167
"fedora-testing"
107-
"rhel-8-9"
108-
"rhel-8-9-distropkg"
168+
"rhel-8-10"
169+
"rhel-8-10-distropkg"
109170
"rhel-9-3"
110171
"rhel4edge",
111172
"ubuntu-2204"
112173
"ubuntu-stable"
113-
"fedora-38" is the default (TEST_OS_DEFAULT in bots/lib/constants.py)
174+
"fedora-39" is the default (TEST_OS_DEFAULT in bots/lib/constants.py)
114175

115176
TEST_JOBS How many tests to run in parallel. The default is 1.
116177

external/wiki/Contributing.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ https://cockpit-project.org/running.html
1414
* Keep in mind the [project ideals]({{ site.baseurl }}/ideals.html)
1515
* If you are looking for someplace to start developing, issues are marked [with a good-first-issue label](https://github.com/cockpit-project/cockpit/issues?q=is%3Aopen+is%3Aissue+label%3Agood-first-issue) when they are a good introduction to Cockpit and of limited scope.
1616
* [Documentation]({{ site.baseurl }}/guide/latest/) (be aware: possible version differences)
17-
* [Set up integration tests](https://github.com/cockpit-project/cockpit/blob/master/test/README.md). Automated tests are an important part of Cockpit and every new feature should be accompanied by its tests.
17+
* [Set up integration tests](https://github.com/cockpit-project/cockpit/blob/master/test/README.md). Automated tests are an important part of Cockpit and every new feature should be accompanied by its tests.
18+
* Join the project's [GitHub Discussions page](https://github.com/cockpit-project/cockpit/discussions) to connect with the community, ask questions, and participate in discussions about the project's development and features.
1819

1920
### Issue tracker
2021

0 commit comments

Comments
 (0)