Skip to content

Commit

Permalink
tests: Update devlxd request source identification (#286)
Browse files Browse the repository at this point in the history
This is needed because
[#14056](canonical/lxd#14056) changed how we
identify a request as coming from the /dev/lxd socket. If version
checking for 5.21 and after is needed here please let me know. Not sure
how/if the metrics will be backported.
  • Loading branch information
tomponline authored Sep 13, 2024
2 parents 1ee2fe1 + 9e187da commit a99f3d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/devlxd-container
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ kill -9 "${monitorPID}"

# If the guest retrieved the image from the host, the host should emit an "image-retrieved" lifecycle event. The
# requestor address tells us that this was definitely the guest.
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.address')" = "@devlxd" ]
# Newer LXD versions use the protocol instead of the requestor address to distinguish devlxd requests
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.address')" = "@devlxd" ] || \
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.protocol')" = "devlxd" ]
rm monitor.json

echo "==> Deleting container"
Expand Down
3 changes: 2 additions & 1 deletion tests/devlxd-vm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ if hasNeededAPIExtension devlxd_images_vm; then

# If the guest retrieved the image from the host, the host should emit an "image-retrieved" lifecycle event. The
# requestor address tells us that this was definitely the guest.
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.address')" = "@devlxd" ]
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.address')" = "@devlxd" ] || \
[ "$(grep -wF 'image-retrieved' monitor.json | jq -r '.metadata.requestor.protocol')" = "devlxd" ]
rm monitor.json
fi

Expand Down

0 comments on commit a99f3d2

Please sign in to comment.