diff --git a/src/runtime/virtcontainers/pkg/oci/utils.go b/src/runtime/virtcontainers/pkg/oci/utils.go index 4cdfb5248f..bbef21e9b3 100644 --- a/src/runtime/virtcontainers/pkg/oci/utils.go +++ b/src/runtime/virtcontainers/pkg/oci/utils.go @@ -323,18 +323,6 @@ func networkConfig(ocispec specs.Spec, config RuntimeConfig) (vc.NetworkConfig, return netConf, nil } -// GetContainerType determines which type of container matches the annotations -// table provided. -func GetContainerType(annotations map[string]string) (vc.ContainerType, error) { - if containerType, ok := annotations[vcAnnotations.ContainerTypeKey]; ok { - return vc.ContainerType(containerType), nil - } - - ociLog.Errorf("Annotations[%s] not found, cannot determine the container type", - vcAnnotations.ContainerTypeKey) - return vc.UnknownContainerType, fmt.Errorf("Could not find container type") -} - // ContainerType returns the type of container and if the container type was // found from CRI servers annotations. func ContainerType(spec specs.Spec) (vc.ContainerType, error) { diff --git a/src/runtime/virtcontainers/pkg/oci/utils_test.go b/src/runtime/virtcontainers/pkg/oci/utils_test.go index 50b44b2c32..1cdb889fbe 100644 --- a/src/runtime/virtcontainers/pkg/oci/utils_test.go +++ b/src/runtime/virtcontainers/pkg/oci/utils_test.go @@ -188,38 +188,6 @@ func TestMinimalSandboxConfig(t *testing.T) { assert.NoError(os.Remove(configPath)) } -func testGetContainerTypeSuccessful(t *testing.T, annotations map[string]string, expected vc.ContainerType) { - assert := assert.New(t) - containerType, err := GetContainerType(annotations) - assert.NoError(err) - assert.Equal(containerType, expected) -} - -func TestGetContainerTypePodSandbox(t *testing.T) { - annotations := map[string]string{ - vcAnnotations.ContainerTypeKey: string(vc.PodSandbox), - } - - testGetContainerTypeSuccessful(t, annotations, vc.PodSandbox) -} - -func TestGetContainerTypePodContainer(t *testing.T) { - annotations := map[string]string{ - vcAnnotations.ContainerTypeKey: string(vc.PodContainer), - } - - testGetContainerTypeSuccessful(t, annotations, vc.PodContainer) -} - -func TestGetContainerTypeFailure(t *testing.T) { - expected := vc.UnknownContainerType - assert := assert.New(t) - - containerType, err := GetContainerType(map[string]string{}) - assert.Error(err) - assert.Equal(containerType, expected) -} - func testContainerTypeSuccessful(t *testing.T, ociSpec specs.Spec, expected vc.ContainerType) { containerType, err := ContainerType(ociSpec) assert := assert.New(t)