oci: remove unused function GetContainerType

This is unused - we utilize ContainerType directly.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
Eric Ernst 2021-10-27 07:51:16 -07:00
parent e34893a0c4
commit b6ebddd7ef
2 changed files with 0 additions and 44 deletions

View File

@ -323,18 +323,6 @@ func networkConfig(ocispec specs.Spec, config RuntimeConfig) (vc.NetworkConfig,
return netConf, nil 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 // ContainerType returns the type of container and if the container type was
// found from CRI servers annotations. // found from CRI servers annotations.
func ContainerType(spec specs.Spec) (vc.ContainerType, error) { func ContainerType(spec specs.Spec) (vc.ContainerType, error) {

View File

@ -188,38 +188,6 @@ func TestMinimalSandboxConfig(t *testing.T) {
assert.NoError(os.Remove(configPath)) 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) { func testContainerTypeSuccessful(t *testing.T, ociSpec specs.Spec, expected vc.ContainerType) {
containerType, err := ContainerType(ociSpec) containerType, err := ContainerType(ociSpec)
assert := assert.New(t) assert := assert.New(t)