modify code to compile on updated containerd

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
Mike Brown
2017-06-07 14:41:30 -05:00
committed by Lantao Liu
parent 67e884e6cf
commit 484a326717
27 changed files with 444 additions and 453 deletions

View File

@@ -33,7 +33,6 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/registrar"
agentstesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/agents/testing"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
imagedigest "github.com/opencontainers/go-digest"
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
@@ -67,7 +66,7 @@ func newTestCRIContainerdService() *criContainerdService {
containerStore: metadata.NewContainerStore(store.NewMetadataStore()),
containerNameIndex: registrar.NewRegistrar(),
containerService: servertesting.NewFakeExecutionClient(),
rootfsService: servertesting.NewFakeRootfsClient(),
snapshotService: servertesting.NewFakeSnapshotClient(),
netPlugin: servertesting.NewFakeCNIPlugin(),
agentFactory: agentstesting.NewFakeAgentFactory(),
}
@@ -77,7 +76,8 @@ func newTestCRIContainerdService() *criContainerdService {
func TestSandboxOperations(t *testing.T) {
c := newTestCRIContainerdService()
fake := c.containerService.(*servertesting.FakeExecutionClient)
fakeRootfsClient := c.rootfsService.(*servertesting.FakeRootfsClient)
// TODO(random-liu): Clean this up if needed.
// fakeSnapshotClient := c.snapshotService.(*servertesting.FakeSnapshotClient)
fakeOS := c.os.(*ostesting.FakeOS)
fakeCNIPlugin := c.netPlugin.(*servertesting.FakeCNIPlugin)
fakeOS.OpenFifoFn = func(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
@@ -89,8 +89,6 @@ func TestSandboxOperations(t *testing.T) {
ChainID: "test-chain-id",
Config: &imagespec.ImageConfig{Entrypoint: []string{"/pause"}},
}))
// Insert fake chainID
fakeRootfsClient.SetFakeChainIDs([]imagedigest.Digest{imagedigest.Digest("test-chain-id")})
config := &runtime.PodSandboxConfig{
Metadata: &runtime.PodSandboxMetadata{
@@ -112,8 +110,8 @@ func TestSandboxOperations(t *testing.T) {
id := runRes.GetPodSandboxId()
t.Logf("should be able to get pod sandbox status")
info, err := fake.Info(context.Background(), &execution.InfoRequest{ID: id})
netns := getNetworkNamespace(info.Pid)
info, err := fake.Info(context.Background(), &execution.InfoRequest{ContainerID: id})
netns := getNetworkNamespace(info.Task.Pid)
assert.NoError(t, err)
expectSandboxStatus := &runtime.PodSandboxStatus{
Id: id,
@@ -146,7 +144,7 @@ func TestSandboxOperations(t *testing.T) {
expectSandbox := &runtime.PodSandbox{
Id: id,
Metadata: config.GetMetadata(),
State: runtime.PodSandboxState_SANDBOX_READY,
State: runtime.PodSandboxState_SANDBOX_NOTREADY, // TODO(mikebrow) converting to client... should this be ready?
Labels: config.GetLabels(),
Annotations: config.GetAnnotations(),
}