Exemplo n.º 1
0
	"errors"

	"github.com/cloudfoundry-incubator/garden-linux/layercake"
	"github.com/cloudfoundry-incubator/garden-linux/layercake/fake_cake"
	"github.com/cloudfoundry-incubator/garden-linux/layercake/fake_retainer"
	"github.com/docker/docker/image"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/lager/lagertest"
)

// Pended until #102455044 is delivered
var _ = PDescribe("Oven cleaner", func() {
	var gc *layercake.OvenCleaner
	var fakeCake *fake_cake.FakeCake
	var fakeRetainer *fake_retainer.FakeRetainer
	var child2parent map[layercake.ID]layercake.ID // child -> parent

	BeforeEach(func() {
		fakeCake = new(fake_cake.FakeCake)
		fakeRetainer = new(fake_retainer.FakeRetainer)
		gc = &layercake.OvenCleaner{
			Cake:     fakeCake,
			Retainer: fakeRetainer,
			Logger:   lagertest.NewTestLogger("test"),
		}

		child2parent = make(map[layercake.ID]layercake.ID)
		fakeCake.GetStub = func(id layercake.ID) (*image.Image, error) {
			if parent, ok := child2parent[id]; ok {
				return &image.Image{ID: id.GraphID(), Parent: parent.GraphID()}, nil
Exemplo n.º 2
0
	"github.com/pivotal-golang/lager/lagertest"

	"math"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"
)

var _ = Describe("RemoteV2", func() {
	var (
		fetcher      *RemoteV2Fetcher
		server       *ghttp.Server
		cake         *fake_cake.FakeCake
		lock         *fake_lock.FakeLock
		logger       *lagertest.TestLogger
		fetchRequest *FetchRequest
		retainer     *fake_retainer.FakeRetainer

		registryAddr string
	)

	BeforeEach(func() {
		cake = new(fake_cake.FakeCake)
		lock = new(fake_lock.FakeLock)

		logger = lagertest.NewTestLogger("test")

		server = ghttp.NewServer()
		server.RouteToHandler(
			"GET", "/v2/",