From 496843899233b33d7df858d26db41a0a18160bde Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 4 Jul 2019 15:53:04 +0100 Subject: [PATCH] tests: Fix fork/exec test error Fixed `TestSandboxCreationFromConfigRollbackFromCreateSandbox` which requires that the hypervisor does not exist. Unfortunately, it does exist (as a fake test binary), but isn't executable meaning although the test failed (since an error is expected), rather than the expected `ENOENT` error, the test was logging a message similar to the following since the fake hypervisor exists with non-executable permissions: ``` Unable to launch /tmp/vc-tmp-526112270/hypervisor: fork/exec /tmp/vc-tmp-526112270/hypervisor: permission denied ``` Fixes: #1835. Signed-off-by: James O. D. Hunt --- virtcontainers/sandbox_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virtcontainers/sandbox_test.go b/virtcontainers/sandbox_test.go index 82c6dce6f..375d4c21c 100644 --- a/virtcontainers/sandbox_test.go +++ b/virtcontainers/sandbox_test.go @@ -1530,6 +1530,10 @@ func TestSandboxCreationFromConfigRollbackFromCreateSandbox(t *testing.T) { Volumes: nil, Containers: nil, } + + // Ensure hypervisor doesn't exist + assert.NoError(os.Remove(hConf.HypervisorPath)) + _, err := createSandboxFromConfig(ctx, sConf, nil) // Fail at createSandbox: QEMU path does not exist, it is expected. Then rollback is called assert.Error(err)