Skip to content

Commit

Permalink
tests: Fix fork/exec test error
Browse files Browse the repository at this point in the history
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: kata-containers#1835.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
  • Loading branch information
jodh-intel committed Jul 5, 2019
1 parent fcf9f9f commit 4968438
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtcontainers/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4968438

Please sign in to comment.