Skip to content

Commit

Permalink
mantle/kolet: Use PathChanged instead of PathExists
Browse files Browse the repository at this point in the history
The previous code (changed in 4f4dfe6) copied to a partial file
and then renamed which meant PathExists would trigger as soon
as the file path exists, which was too soon because the file is
still copying.

PathChanged seems to work for our purposes here since it will
trigger when the file is closed after it is done writing.
  • Loading branch information
dustymabe committed Sep 22, 2024
1 parent 7df4972 commit 01c87ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/kola/external-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ In the following Fedora CoreOS config example, the Ignition config includes a
path unit and a service unit. The path unit ensures that the httpd service runs
automatically once the Kolet binary is copied to the system. Note that the path
unit has a `Before=` dependency on `kola-runext.service` to ensure that the
server is brought up before the test is run.
server is brought up before the test is run. Note also that `PathChanged` will
trigger once the `kolet` binary has finished copying to the system.
An HTTP server will be started at `localhost` and serve the files in `/var/www/`.
Your test can then do e.g. `curl localhost/hello_world.txt`.

Expand All @@ -154,7 +155,7 @@ systemd:
[Unit]
Before=kola-runext.service
[Path]
PathExists=/usr/local/bin/kolet
PathChanged=/usr/local/bin/kolet
[Install]
WantedBy=kola-runext.service
- name: kolet-httpd.service
Expand Down
2 changes: 1 addition & 1 deletion mantle/kola/tests/upgrade/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func init() {
{
"name": "kolet-httpd.path",
"enabled": true,
"contents": "[Path]\nPathExists=/usr/local/bin/kolet\n[Install]\nWantedBy=multi-user.target"
"contents": "[Path]\nPathChanged=/usr/local/bin/kolet\n[Install]\nWantedBy=multi-user.target"
},
{
"name": "kolet-httpd.service",
Expand Down

0 comments on commit 01c87ab

Please sign in to comment.