Skip to content

Commit 05745ce

Browse files
authored
Update external docs
1 parent 4e8e0c6 commit 05745ce

File tree

4 files changed

+63
-25
lines changed

4 files changed

+63
-25
lines changed

external/bots/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ For managing these images:
3232

3333
- `image-download`: Download selected or all test images
3434
- `image-create`: Create test machine images from scratch (usually through
35-
virt-install or downloading a cloud image), with common build and test
36-
dependencies for Cockpit projects preinstalled
35+
downloading a cloud image), with common build and test dependencies for
36+
Cockpit projects preinstalled
3737
- `image-upload`: Upload a locally built test image to the official image servers
3838

3939
For running and debugging the images:

external/source/HACKING.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,27 @@ To re-create your development container from the latest image, run:
6363
## Working on Cockpit's session pages
6464

6565
Most contributors want to work on the web (HTML, JavaScript, CSS) parts of Cockpit.
66+
67+
### Install Cockpit
68+
6669
First, install Cockpit on your local machine as described in:
6770

6871
<https://cockpit-project.org/running.html>
6972

73+
### Build session pages
74+
7075
Next, run this command from your top level Cockpit checkout directory, and make
7176
sure to run it as the same user that you'll use to log into Cockpit below.
7277

7378
mkdir -p ~/.local/share/
7479
ln -s $(pwd)/dist ~/.local/share/cockpit
7580

76-
This will cause cockpit to read JavaScript, HTML, and CSS files directly from the
81+
This will cause Cockpit to read JavaScript, HTML, and CSS files directly from the
7782
locally built package output directory instead of using the system-installed Cockpit
7883
files.
7984

80-
Now you can log into Cockpit on your local Linux machine at the following
81-
address. Use the same user and password that you used to log into your Linux
82-
desktop.
83-
84-
<http://localhost:9090>
85-
86-
After every change to the source files, bundles need to be rebuilt. The
87-
recommended and fastest way is to do that is using the "watch" mode (`-w` or
88-
`--watch`) on the page that you are working on. For example, if you want to
85+
The recommended way to build bundles is to use the "watch" mode
86+
(`-w` or`--watch`) on the page you are working on. For example, if you want to
8987
work on anything in [pkg/systemd](https://github.com/cockpit-project/cockpit/tree/main/pkg/systemd/), run:
9088

9189
./build.js -w systemd
@@ -97,8 +95,16 @@ pkg/lib/), you can also build all pages:
9795

9896
./build.js -w
9997

100-
Reload cockpit in your browser after page is built. Press `Ctrl`-`C` to
101-
stop watch mode once you are done with changing the code.
98+
Now you can log into Cockpit on your local Linux machine at the following
99+
address, using the same username and password as your desktop login:
100+
101+
<http://localhost:9090>
102+
103+
Watch mode automatically rebuilds when source files are modified. Once it
104+
finishes building, refresh your browser to see the changes in Cockpit.
105+
Press `Ctrl-C` to stop watch mode when you are done changing the code.
106+
107+
### Testing
102108

103109
You often need to test code changes in a VM. You can set the `$RSYNC` env
104110
variable to copy the built page into the given SSH target's
@@ -109,6 +115,8 @@ one of these commands:
109115
RSYNC=c ./build.js -w kdump
110116
RSYNC=c ./build.js -w
111117

118+
### Returning to system packages
119+
112120
To make Cockpit use system packages again, instead of your checkout directory,
113121
remove the symlink with the following command and log back into Cockpit:
114122

@@ -152,10 +160,26 @@ which will output a URL to connect to with a browser, such as
152160
<http://localhost:8765/qunit/base1/test-dbus.html>. Adjust the path for different
153161
tests and inspect the results there.
154162

155-
You can also run individual tests by specifying the `TESTS` environment
156-
variable:
163+
QUnit tests are run as part of a pytest test called `test_browser`. You can
164+
run individual tests via `pytest -k`, like so:
165+
166+
pytest -k test-fsinfo.html
167+
168+
You can see JavaScript code coverage information for QUnit tests. For a
169+
summary table:
170+
171+
pytest -k test_browser --js-cov
172+
173+
And for detailed output on uncovered sections in a specific file, something
174+
like:
175+
176+
pytest -k test-fsinfo.html --js-cov-files='*/fsinfo.ts'
177+
178+
Coverage information is gathered into the pytest tmpdir, regardless of which
179+
coverage-related commandline flags are given, so it's also possible to drill
180+
down after the fact — without re-running tests — using something like:
157181

158-
make check TESTS=qunit/base1/test-chan.html
182+
test/common/js_coverage.py -m '*/fsinfo.ts' /tmp/pytest-of-*/pytest-current/js-coverage/*
159183

160184
There are also static code and syntax checks which you should run often:
161185

@@ -199,7 +223,7 @@ The Python bridge can be used interactively on a local machine:
199223
To make it easy to test out channels without having to write out messages
200224
manually, `cockpit.misc.print` can be used:
201225

202-
PYTHONPATH=src python3 -m cockpit.misc.print open fslist1 path=/etc watch=False | PYTHONPATH=src python3 -m cockpit.bridge
226+
PYTHONPATH=src python3 -m cockpit.misc.print open fsinfo path=/etc 'attrs=["type", "entries"]' | PYTHONPATH=src python3 -m cockpit.bridge
203227

204228
These shell aliases might be useful when experimenting with the protocol:
205229

external/source/test/README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,15 @@ You can set these environment variables to configure the test suite:
172172
"centos-10"
173173
"debian-stable"
174174
"debian-testing"
175-
"fedora-39"
176175
"fedora-40"
177176
"fedora-coreos"
178177
"rhel-9-4"
179-
"rhel4edge",
180178
"ubuntu-2204"
181179
"ubuntu-stable"
182-
"fedora-39" is the default (TEST_OS_DEFAULT in bots/lib/constants.py)
180+
"fedora-40" is the default (TEST_OS_DEFAULT in bots/lib/constants.py)
183181

184182
TEST_JOBS How many tests to run in parallel. The default is 1.
185183

186-
TEST_CDP_PORT Attach to an actually running browser that is compatible with
187-
the Chrome Debug Protocol, on the given port. Don't use this
188-
with parallel tests.
189-
190184
TEST_BROWSER What browser should be used for testing. Currently supported values:
191185
"chromium"
192186
"firefox"

external/wiki/Proxying-Cockpit-over-Apache-with-LetsEncrypt.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,26 @@ Change this file so it looks like the following.
101101
</IfModule>
102102
```
103103

104+
With Apache 2.4.47 or later, this could also be written as:
105+
106+
```apacheconf
107+
<IfModule mod_ssl.c>
108+
<VirtualHost *:443>
109+
ServerName cockpit.your-domain.com
110+
SSLCertificateFile /etc/letsencrypt/live/cockpit.your-domain.com/fullchain.pem
111+
SSLCertificateKeyFile /etc/letsencrypt/live/cockpit.your-domain.com/privkey.pem
112+
Include /etc/letsencrypt/options-ssl-apache.conf
113+
114+
ProxyPreserveHost On
115+
ProxyRequests Off
116+
117+
# Proxy to your local cockpit instance
118+
ProxyPass / http://127.0.0.1:9090/ upgrade=websocket
119+
ProxyPassReverse / http://127.0.0.1:9090/
120+
</VirtualHost>
121+
</IfModule>
122+
```
123+
104124
Save and close the file. Then restart Apache web server.
105125

106126
`sudo systemctl restart apache2`

0 commit comments

Comments
 (0)