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
| # Remove conflicting xe-guest-utilities if present | ||
| logging.info("Removing xe-guest-utilities if present") | ||
| if pkg_mgr == PackageManagerEnum.RPM: | ||
| vm.execute_script('rpm -qa | grep xe-guest-utilities | xargs --no-run-if-empty rpm -e') |
There was a problem hiding this comment.
You can use vm.ssh(…) here
| vm.execute_script('rpm -qa | grep xe-guest-utilities | xargs --no-run-if-empty rpm -e') | |
| vm.ssh('rpm -qa | grep xe-guest-utilities | xargs --no-run-if-empty rpm -e') |
There was a problem hiding this comment.
Yes. Thanks. Addressed.
| # VIF detection requires a Xen PV NIC; skip if none was detected | ||
| if host.ssh_with_result(['xenstore-exists', f'{xs_prefix}/attr/vif']).returncode != 0: | ||
| pytest.skip("No VIF published in Xenstore — VM may not be using a Xen PV NIC") | ||
| published_ip = host.ssh(['xenstore-read', f'{xs_prefix}/attr/vif/0/ipv4/0']) |
There was a problem hiding this comment.
We have some IPv6-only tests, so this should probably test for both ip v4 and v6 addresses.
There was a problem hiding this comment.
yes. Addressed. I have added IPv6 support.
| if pkg_mgr == PackageManagerEnum.RPM: | ||
| vm.ssh(['yum', 'remove', '-y', 'xen-guest-agent']) | ||
| if pkg_mgr == PackageManagerEnum.APT_GET: | ||
| vm.ssh(['apt-get', 'remove', '-y', 'xen-guest-agent']) |
There was a problem hiding this comment.
Not sure if this is useful, but the previously removed xe-guest-utilities is not restored here
There was a problem hiding this comment.
Yes, I have dropped all this. The VM will be destroyed anyway afterwards.
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. |
9ce50ba to
86662db
Compare
Add a test suite that validates the xen-guest-agent daemon running inside a guest VM correctly publishes data to Xenstore. The conftest downloads RPM and DEB packages from the xen-guest-agent GitLab CI artifacts and SCPs them to the VM for installation. The test class (TestXenGuestAgent) then installs the agent on the VM via yum (RPM distros) or dpkg (APT distros), then verifies: - the systemd service is active after install and after reboot - Xenstore paths for version, OS info, memory and VIF IP are populated (meminfo_free is polled with a 90s timeout as it is only published on a 60s timer; the VIF/IP check is skipped if no Xen PV NIC is present) Signed-off-by: Julian Vetter <julian.vetter@vates.tech>
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 |
Description
Add a test suite that validates the xen-guest-agent daemon running inside a guest VM correctly publishes data to Xenstore. The conftest downloads RPM and DEB packages from the xen-guest-agent GitLab CI artifacts and SCPs them to the VM for installation.
The test class (TestXenGuestAgent) then installs the agent on the VM via yum (RPM distros) or dpkg (APT distros), then verifies: