Skip to content

Commit

Permalink
Merge pull request moby#39980 from SamWhited/image_dependency
Browse files Browse the repository at this point in the history
testutil, integration: untangle image dependency
  • Loading branch information
tiborvass authored Sep 26, 2019
2 parents 39e6def + ae0a878 commit b4c9b4a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 43 deletions.
24 changes: 22 additions & 2 deletions integration/image/remove_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ import (
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"testing"
"unsafe"

"github.com/docker/docker/api/types"
_ "github.com/docker/docker/daemon/graphdriver/register" // register graph drivers
"github.com/docker/docker/daemon/images"
"github.com/docker/docker/layer"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/testutil/daemon"
"github.com/docker/docker/testutil/fakecontext"
"gotest.tools/assert"
Expand All @@ -31,13 +37,27 @@ func TestRemoveImageGarbageCollector(t *testing.T) {

// Create daemon with overlay2 graphdriver because vfs uses disk differently
// and this test case would not work with it.
d := daemon.New(t, daemon.WithStorageDriver("overlay2"), daemon.WithImageService)
d := daemon.New(t, daemon.WithStorageDriver("overlay2"))
d.Start(t)
defer d.Stop(t)

ctx := context.Background()
client := d.NewClientT(t)
i := d.ImageService()

layerStores := make(map[string]layer.Store)
layerStores[runtime.GOOS], _ = layer.NewStoreFromOptions(layer.StoreOptions{
Root: d.Root,
MetadataStorePathTemplate: filepath.Join(d.RootDir(), "image", "%s", "layerdb"),
GraphDriver: d.StorageDriver(),
GraphDriverOptions: nil,
IDMapping: &idtools.IdentityMapping{},
PluginGetter: nil,
ExperimentalEnabled: false,
OS: runtime.GOOS,
})
i := images.NewImageService(images.ImageServiceConfig{
LayerStores: layerStores,
})

img := "test-garbage-collector"

Expand Down
7 changes: 0 additions & 7 deletions testutil/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/client"
"github.com/docker/docker/daemon/images"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
Expand Down Expand Up @@ -72,7 +71,6 @@ type Daemon struct {
init bool
dockerdBinary string
log logT
imageService *images.ImageService

// swarm related field
swarmListenAddr string
Expand Down Expand Up @@ -721,8 +719,3 @@ func cleanupRaftDir(t testing.TB, rootPath string) {
}
}
}

// ImageService returns the Daemon's ImageService
func (d *Daemon) ImageService() *images.ImageService {
return d.imageService
}
34 changes: 0 additions & 34 deletions testutil/daemon/ops_unix.go

This file was deleted.

0 comments on commit b4c9b4a

Please sign in to comment.