tests: Refactors PodSandbox creation
Most of the tests creating and using Pod Sandboxes in the same way. We can create a common function that will do that for us, so we can have less duplicated code, and make it easier to add new tests in the future. Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
This commit is contained in:
@@ -29,20 +29,12 @@ import (
|
||||
// TODO(chrisfegly): add/update test(s) to allow testing of multiple runtimes at the same time
|
||||
func TestRuntimeHandler(t *testing.T) {
|
||||
t.Logf("Create a sandbox")
|
||||
sbConfig := PodSandboxConfig("sandbox", "test-runtime-handler")
|
||||
|
||||
if *runtimeHandler == "" {
|
||||
t.Logf("The --runtime-handler flag value is empty which results internally to setting the default runtime")
|
||||
} else {
|
||||
t.Logf("The --runtime-handler flag value is %s", *runtimeHandler)
|
||||
}
|
||||
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
// Make sure the sandbox is cleaned up in any case.
|
||||
runtimeService.StopPodSandbox(sb)
|
||||
runtimeService.RemovePodSandbox(sb)
|
||||
}()
|
||||
sb, _ := PodSandboxConfigWithCleanup(t, "sandbox", "test-runtime-handler")
|
||||
|
||||
t.Logf("Verify runtimeService.PodSandboxStatus() returns previously set runtimeHandler")
|
||||
sbStatus, err := runtimeService.PodSandboxStatus(sb)
|
||||
|
Reference in New Issue
Block a user