Remove sandbox truncindex.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2017-06-05 20:59:50 +00:00
parent a393f3a084
commit 4317e6119a
15 changed files with 13 additions and 126 deletions

View File

@@ -28,7 +28,6 @@ import (
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"
)
@@ -119,49 +118,6 @@ func TestPrepareStreamingPipesError(t *testing.T) {
}
}
func TestGetSandbox(t *testing.T) {
c := newTestCRIContainerdService()
testID := "abcdefg"
testSandbox := metadata.SandboxMetadata{
ID: testID,
Name: "test-name",
}
assert.NoError(t, c.sandboxStore.Create(testSandbox))
assert.NoError(t, c.sandboxIDIndex.Add(testID))
for desc, test := range map[string]struct {
id string
expected *metadata.SandboxMetadata
expectErr bool
}{
"full id": {
id: testID,
expected: &testSandbox,
expectErr: false,
},
"partial id": {
id: testID[:3],
expected: &testSandbox,
expectErr: false,
},
"non-exist id": {
id: "gfedcba",
expected: nil,
expectErr: true,
},
} {
t.Logf("TestCase %q", desc)
sb, err := c.getSandbox(test.id)
if test.expectErr {
assert.Error(t, err)
assert.True(t, metadata.IsNotExistError(err))
} else {
assert.NoError(t, err)
}
assert.Equal(t, test.expected, sb)
}
}
func TestNormalizeImageRef(t *testing.T) {
for _, test := range []struct {
input string