Skip to content

Commit

Permalink
Tests: Handle various names of the qemu binary
Browse files Browse the repository at this point in the history
Qemu binary may have different names depending on the base container
image used by virt-launcher. E.g. qemu-kvm or qemu-system-x86_64. Try
to handle that by considering also the qemu-system-* prefix when looking
through the list of running processes.

Signed-off-by: Vasiliy Ulyanov <[email protected]>
  • Loading branch information
vasiliy-ul committed Aug 12, 2022
1 parent b6e7b48 commit 274ddbd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/vmi_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2992,14 +2992,18 @@ var _ = Describe("[sig-compute]Configurations", func() {
Expect(len(fields)).To(BeNumerically(">=", 2))
rss := fields[0]
command := filepath.Base(fields[1])
// Handle the qemu binary: e.g. qemu-kvm or qemu-system-x86_64
if command == "qemu-kvm" || strings.HasPrefix(command, "qemu-system-") {
command = "qemu"
}
switch command {
case "virt-launcher-monitor", "virt-launcher", "virtlogd", "libvirtd", "qemu-kvm":
case "virt-launcher-monitor", "virt-launcher", "virtlogd", "libvirtd", "qemu":
Expect(processRss).ToNot(HaveKey(command), "multiple %s processes found", command)
value := resource.MustParse(rss + "Ki")
processRss[command] = value
}
}
for _, process := range []string{"virt-launcher-monitor", "virt-launcher", "virtlogd", "libvirtd", "qemu-kvm"} {
for _, process := range []string{"virt-launcher-monitor", "virt-launcher", "virtlogd", "libvirtd", "qemu"} {
Expect(processRss).To(HaveKey(process), "no %s process found", process)
}

Expand All @@ -3010,7 +3014,7 @@ var _ = Describe("[sig-compute]Configurations", func() {
doesntExceedMemoryUsage(&processRss, "libvirtd", resource.MustParse(services.LibvirtdOverhead))
qemuExpected := resource.MustParse(services.QemuOverhead)
qemuExpected.Add(vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory])
doesntExceedMemoryUsage(&processRss, "qemu-kvm", qemuExpected)
doesntExceedMemoryUsage(&processRss, "qemu", qemuExpected)
})
})
})
Expand Down

0 comments on commit 274ddbd

Please sign in to comment.