Beispiel #1
0
	"code.cloudfoundry.org/garden-shed/docker_drivers/aufs"
	fakes "code.cloudfoundry.org/garden-shed/docker_drivers/aufs/aufsfakes"
	"code.cloudfoundry.org/garden-shed/layercake"
	"code.cloudfoundry.org/lager/lagertest"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("QuotaedDriver", func() {
	var (
		fakeGraphDriver     *fakes.FakeGraphDriver
		fakeLoopMounter     *fakes.FakeLoopMounter
		fakeBackingStoreMgr *fakes.FakeBackingStoreMgr
		fakeRetrier         *fakes.FakeRetrier
		fakeUnmount         aufs.UnmountFunc

		driver *aufs.QuotaedDriver

		rootPath string
	)

	BeforeEach(func() {
		rootPath = "/path/to/my/banana/graph"

		fakeGraphDriver = new(fakes.FakeGraphDriver)
		fakeLoopMounter = new(fakes.FakeLoopMounter)
		fakeBackingStoreMgr = new(fakes.FakeBackingStoreMgr)
		fakeRetrier = new(fakes.FakeRetrier)
		fakeUnmount = func(path string) error {
			return nil
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

const (
	pollingInterval = 100 * time.Millisecond
	numRetries      = 3 // At least 3 so that we can test the case where it works after multiple (2) retries
)

var _ = Describe("LoopLinux", func() {
	var (
		bsFilePath string
		destPath   string
		loop       *aufs.Loop

		fakeRetrier *fakes.FakeRetrier
	)

	BeforeEach(func() {
		var err error

		tempFile, err := ioutil.TempFile("", "loop")
		Expect(err).NotTo(HaveOccurred())
		bsFilePath = tempFile.Name()
		_, err = exec.Command("truncate", "-s", "10M", bsFilePath).CombinedOutput()
		Expect(err).NotTo(HaveOccurred())
		_, err = exec.Command("mkfs.ext4", "-F", bsFilePath).CombinedOutput()
		Expect(err).NotTo(HaveOccurred())