diff --git a/.gitignore b/.gitignore index c5c684f0e146..513466109f2f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ vendor/**/*_test.go **/polarion.xml tools/manifest-templator/manifest-templator tools/vms-generator/vms-generator +.coverprofile \ No newline at end of file diff --git a/cmd/virt-launcher/virt-launcher.go b/cmd/virt-launcher/virt-launcher.go index 2f5ed5b7cf2c..db49e375e956 100644 --- a/cmd/virt-launcher/virt-launcher.go +++ b/cmd/virt-launcher/virt-launcher.go @@ -50,7 +50,6 @@ import ( const defaultStartTimeout = 3 * time.Minute const defaultWatchdogInterval = 5 * time.Second -const hookSidecarsCollectTimeout = 10 * time.Second func markReady(readinessFile string) { f, err := os.OpenFile(readinessFile, os.O_RDONLY|os.O_CREATE, 0666) @@ -268,7 +267,7 @@ func main() { // Block until all requested hookSidecars are ready hookManager := hooks.GetManager() - err := hookManager.Collect(*hookSidecars, hookSidecarsCollectTimeout) + err := hookManager.Collect(*hookSidecars, *qemuTimeout) if err != nil { panic(err) } diff --git a/tests/vmi_hook_sidecar_test.go b/tests/vmi_hook_sidecar_test.go index 04067a6f89ce..06e1ab9e81c1 100644 --- a/tests/vmi_hook_sidecar_test.go +++ b/tests/vmi_hook_sidecar_test.go @@ -35,6 +35,8 @@ import ( "kubevirt.io/kubevirt/tests" ) +const hookSidecarImage = "example-hook-sidecar" + var _ = Describe("HookSidecars", func() { flag.Parse() @@ -48,7 +50,7 @@ var _ = Describe("HookSidecars", func() { tests.BeforeTestCleanup() vmi = tests.NewRandomVMIWithEphemeralDisk(tests.RegistryDiskFor(tests.RegistryDiskAlpine)) vmi.ObjectMeta.Annotations = map[string]string{ - "hooks.kubevirt.io/hookSidecars": `[{"image": "registry:5000/kubevirt/example-hook-sidecar:devel"}]`, + "hooks.kubevirt.io/hookSidecars": fmt.Sprintf(`[{"image": "%s/%s:%s", "imagePullPolicy": "IfNotPresent"}]`, tests.KubeVirtRepoPrefix, hookSidecarImage, tests.KubeVirtVersionTag), "smbios.vm.kubevirt.io/baseBoardManufacturer": "Radical Edward", } }) @@ -62,7 +64,7 @@ var _ = Describe("HookSidecars", func() { tests.WaitForSuccessfulVMIStart(vmi) }, 300) - It("should call Collect on the hook sidecar", func() { + It("should call Collect and OnDefineDomain on the hook sidecar", func() { By("Getting hook-sidecar logs") vmi, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) Expect(err).ToNot(HaveOccurred()) @@ -72,14 +74,6 @@ var _ = Describe("HookSidecars", func() { 11*time.Second, 500*time.Millisecond). Should(ContainSubstring("Hook's Info method has been called")) - }, 300) - - It("should call OnDefineDomain on the hook sidecar", func() { - By("Getting hook-sidecar logs") - vmi, err = virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) - Expect(err).ToNot(HaveOccurred()) - logs := func() string { return getHookSidecarLogs(virtClient, vmi) } - tests.WaitForSuccessfulVMIStart(vmi) Eventually(logs, 11*time.Second, 500*time.Millisecond).