Merge pull request #5033 from chrisfregly/master

Fix TestRuntimeHandler logging
This commit is contained in:
Phil Estes 2021-02-17 21:53:17 -05:00 committed by GitHub
commit a98c83c2d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,10 +26,16 @@ import (
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
)
// 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")
t.Logf("the --runtime-handler flag value is: %s", *runtimeHandler)
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() {
@ -38,15 +44,13 @@ func TestRuntimeHandler(t *testing.T) {
runtimeService.RemovePodSandbox(sb)
}()
t.Logf("Verify runtimeService.PodSandboxStatus sets RuntimeHandler")
t.Logf("Verify runtimeService.PodSandboxStatus() returns previously set runtimeHandler")
sbStatus, err := runtimeService.PodSandboxStatus(sb)
require.NoError(t, err)
t.Logf("runtimeService.PodSandboxStatus sets RuntimeHandler to %s", sbStatus.RuntimeHandler)
assert.Equal(t, *runtimeHandler, sbStatus.RuntimeHandler)
t.Logf("Verify runtimeService.ListPodSandbox sets RuntimeHandler")
t.Logf("Verify runtimeService.ListPodSandbox() returns previously set runtimeHandler")
sandboxes, err := runtimeService.ListPodSandbox(&runtime.PodSandboxFilter{})
require.NoError(t, err)
t.Logf("runtimeService.ListPodSandbox sets RuntimeHandler to %s", sbStatus.RuntimeHandler)
assert.Equal(t, *runtimeHandler, sandboxes[0].RuntimeHandler)
}