From 79631498af96447c9dd567cdf4f8d921994d308a Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 16 Jun 2017 13:51:24 -0700 Subject: [PATCH] Set image on rootfs options Signed-off-by: Michael Crosby --- benchmark_test.go | 4 ++-- checkpoint_test.go | 4 ++-- client.go | 2 ++ container_test.go | 12 ++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/benchmark_test.go b/benchmark_test.go index e06c814de..451c482e8 100644 --- a/benchmark_test.go +++ b/benchmark_test.go @@ -41,7 +41,7 @@ func BenchmarkContainerCreate(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { id := fmt.Sprintf("%s-%d", b.Name(), i) - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { b.Error(err) return @@ -85,7 +85,7 @@ func BenchmarkContainerStart(b *testing.B) { for i := 0; i < b.N; i++ { id := fmt.Sprintf("%s-%d", b.Name(), i) - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { b.Error(err) return diff --git a/checkpoint_test.go b/checkpoint_test.go index 7afcbb679..ef116062a 100644 --- a/checkpoint_test.go +++ b/checkpoint_test.go @@ -34,7 +34,7 @@ func TestCheckpointRestore(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -127,7 +127,7 @@ func TestCheckpointRestoreNewContainer(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return diff --git a/client.go b/client.go index 2e259e1c1..6036eab2a 100644 --- a/client.go +++ b/client.go @@ -154,6 +154,7 @@ func WithNewRootFS(id string, i Image) NewContainerOpts { return err } c.RootFS = id + c.Image = i.Name() return nil } } @@ -170,6 +171,7 @@ func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts { return err } c.RootFS = id + c.Image = i.Name() return nil } } diff --git a/container_test.go b/container_test.go index 499008182..9ccff895d 100644 --- a/container_test.go +++ b/container_test.go @@ -104,7 +104,7 @@ func TestContainerStart(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -175,7 +175,7 @@ func TestContainerOutput(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -247,7 +247,7 @@ func TestContainerExec(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -342,7 +342,7 @@ func TestContainerProcesses(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -415,7 +415,7 @@ func TestContainerCloseStdin(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return @@ -499,7 +499,7 @@ func TestContainerAttach(t *testing.T) { t.Error(err) return } - container, err := client.NewContainer(ctx, id, WithSpec(spec), WithImage(image), WithNewRootFS(id, image)) + container, err := client.NewContainer(ctx, id, WithSpec(spec), WithNewRootFS(id, image)) if err != nil { t.Error(err) return