tests: add xen-guest-agent integration tests - #434
Conversation
glehmann
left a comment
There was a problem hiding this comment.
I'm not sure we need the complex logic to find and download the last version.
There are not that many releases, so a simple URL should be enough IMO.
I think that would also allow downloading the file directly on the VM
Ok. But the URLs are not easy to find or to browse. What would be a "stable" URL to fetch the deb packages and the rpms from? I have, e.g., |
They are stable as in "they won't go away", but not stable as in "we'll keep the same URL for a new release". Updating the package URL in a PR instead of doing it automatically during the test would also prevent breaking the build in an unplanned way if the new package introduces a regression. Other opinions are welcome :) |
Ping @tperard |
I disagree, URL based on a job_id can disappear from the day to the next, if we change setting on the project to keep only the artefact of the latest pipeline (on a branch) or change the retention to delete old artefacts. We should rely on a branch name or a tag instead. There's Download job artifacts by reference name which makes it simple enough to download the needed artefact. That would give us, for the
And replace But that download all the artefacts as an archive, but there's another API to get one file only, if you know the path, e.g.: With the full archive, you could just extract it, and install all the I've just notice that the two proposed "stable" URL seems to be from tag 0.4.0. I would rather have a self describing URL, but a looking random url with a description in a comment can work too, at the risk that the comment is getting out-of-sync as soon as we update the url. |
Ah nice that's ok. I already have code that extracts the rpms and debs from the archive. With your URL just the {deb,rpm} needs to be set for each archive. This would also always test the latest successful build. I think this is great. This way we make sure we don't have any regressions. |
86662db to
807c506
Compare
|
Note that the URLs I proposed are just the ones from the release page, which have been there for 2 years, so let's say "kind of stable" :) Any opinion on:
@xcp-ng/os-platform-release |
| running_vm.reboot(verify=True) | ||
| running_vm.ssh(['systemctl', 'is-active', 'xen-guest-agent']) | ||
|
|
||
| def test_xenstore_data(self, running_vm): |
There was a problem hiding this comment.
The tests in here should be split into several separate test functions, which is free to do since agent_install has class scope anyway.
IMO another thing that should be tested is reporting of feature-balloon (cf. https://xcp-ng.org/forum/topic/11955/memory-ballooning-dmc-broken-since-xcp-ng-8.3-january-2026-patches/13?_=1775123800568)
There was a problem hiding this comment.
Ok. Addressed. I have split all tests into individual functions.
There was a problem hiding this comment.
I have added a test to see what the balloning feature reports.
| for slot in range(10): # NUM_IFACE_IPS = 10 in xen-guest-agent | ||
| res = host.ssh_with_result( | ||
| ['xenstore-read', f'{xs_prefix}/attr/vif/{vif_id}/{proto}/{slot}'] | ||
| ) |
There was a problem hiding this comment.
I know that this is hardcoded in the guest agent, but we shouldn't make the same assumption in the tests.
There was a problem hiding this comment.
Yes, I dynamically enumerate now the number of interfaces.
b571a89 to
833a9d9
Compare
|
Ping @dinhngtu. I have addressed your comments on the tests. |
833a9d9 to
f2b4552
Compare
| url_download(artifact_urls['rpm'], zip_path) | ||
| rpm_path = _extract_from_zip(zip_path, '.rpm', tmpdir) | ||
|
|
||
| url_download(artifact_urls['deb'], zip_path) |
There was a problem hiding this comment.
Move the download to the VM, we don't need the package locally
There was a problem hiding this comment.
Yes, addressed. I now use some small snippet of python to download and extract the rpms/debs directly inside the VM.
There was a problem hiding this comment.
Are we sure the requested VMs have python3 installed?
There was a problem hiding this comment.
I'm not sure. At least for APT based VMs testing this, I now directly add the repository as a source for apt:
vm.ssh(f"echo 'deb [trusted=yes] {deb_repo} main/' "
f"> /etc/apt/sources.list.d/xen-guest-agent.list")
vm.ssh('apt-get update')
vm.ssh('apt-get install -y xen-guest-agent')
Which makes the whole thing more transparent, and doesn't need any specific tools or features in the VM. For the RPM this is unfortunately not possible as of now. But I will have a look at the xen-guest-tools, if I can add this feature. We would need something with createrepo .... Not sure how much effort this is though.
There was a problem hiding this comment.
I have send a pull request on the xen-guest-agent to deploy RPMs + repomd.xml, so we can use the folder directly as an RPM repository: https://gitlab.com/xen-project/xen-guest-agent/-/merge_requests/101
75b8016 to
3d8c3da
Compare
Install the agent from the CI-published package repositories on a running Linux VM and verify its core Xenstore behaviour: version attributes, OS info, memory counters, feature-balloon flag, and VIF IP publication. RPM packages are served from GitLab Pages (which supports the repodata/ directory structure that DNF requires) and DEB packages are served from the GitLab Generic Package Registry using a numeric project ID to prevent APT from decoding the %2F in the project path. Signed-off-by: Julian Vetter <julian.vetter@vates.tech>
3d8c3da to
f44a732
Compare
|
@xcp-ng/os-platform-release Looks like this PR is ready to be merged. Are we waiting on something? |
|
I don't think so. |
On modern systems that uses dnf, there is a compatibility yum wrapper,
some refactoring can be considered to support more package managers.
Observed issue was:
tests/guest_tools/unix/test_xen_guest_agent.py::TestXenGuestAgent::test_agent_running_after_reboot[...]
lib.commands.SSHCommandFailed: SSH command (dnf install -y xen-guest-agent) failed with return code 127: bash: dnf: command not found
Related-to: #434
Signed-off-by: Philippe Coval <philippe.coval@vates.tech>
| rpm_repo = xen_guest_agent_urls['rpm_repo'] | ||
| vm.ssh(f"echo -e '[xen-guest-agent]\\nbaseurl={rpm_repo}main/\\ngpgcheck=0'" | ||
| f" > /etc/yum.repos.d/xen-guest-agent.repo") | ||
| vm.ssh('dnf install -y xen-guest-agent') |
There was a problem hiding this comment.
Please consider this fixup change:
|
This change is bringing some regressions on some hosts, more testing will be needed to be supported by our CI. |
Even with your fix to "detect" which package manager to use? Can you point me to the CI runs that failed? |
Description
Install the agent from the CI-published package repositories on a running Linux VM and verify its core Xenstore behaviour: version attributes, OS info, memory counters, feature-balloon flag, and VIF IP publication.
RPM packages are served from GitLab Pages (which supports the repodata/ directory structure that DNF requires) and DEB packages are served from the GitLab Generic Package Registry using a numeric project ID to prevent APT from decoding the %2F in the project path.
Signed-off-by: Julian Vetter julian.vetter@vates.tech