. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gexec"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Sandbox Consistency", func() {
	var (
		session        *gexec.Session
		ducatiCmd      *exec.Cmd
		address        string
		containerID    string
		vni            int
		sandboxName    string
		sandboxRepoDir string
		spaceID        string
		appID          string
		networkID      string

		logger *lagertest.TestLogger
		// sandboxRepo        namespace.Repository
		containerRepo      namespace.Repository
		containerNamespace namespace.Namespace

		configFilePath string
	)

	BeforeEach(func() {
		var err error
		address = fmt.Sprintf("127.0.0.1:%d", 4001+GinkgoParallelNode())
		sandboxRepoDir, err = ioutil.TempDir("", "sandbox")
		Expect(err).NotTo(HaveOccurred())
コード例 #2
0
				Expect(err).NotTo(HaveOccurred())
			})

			It("creates the directory", func() {
				_, err := namespace.NewRepository(logger, repoDir, threadLocker)
				Expect(err).NotTo(HaveOccurred())

				info, err := os.Stat(repoDir)
				Expect(err).NotTo(HaveOccurred())
				Expect(info.IsDir()).To(BeTrue())
			})
		})
	})

	Describe("Create", func() {
		var repo namespace.Repository
		var name string

		BeforeEach(func() {
			var err error
			repo, err = namespace.NewRepository(logger, repoDir, threadLocker)
			Expect(err).NotTo(HaveOccurred())

			name = fmt.Sprintf("test-ns-%d", GinkgoParallelNode())
		})

		It("creates a namespace in the repository", func() {
			ns, err := repo.Create(name)
			Expect(err).NotTo(HaveOccurred())

			nsPath := filepath.Join(repoDir, name)
コード例 #3
0
	"os"
	"path"
	"path/filepath"

	"github.com/cloudfoundry-incubator/ducati-daemon/fakes"
	"github.com/cloudfoundry-incubator/ducati-daemon/lib/namespace"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Repository", func() {
	var (
		repo         namespace.Repository
		logger       *lagertest.TestLogger
		threadLocker *fakes.OSThreadLocker
		dir          string
	)

	BeforeEach(func() {
		var err error
		dir, err = ioutil.TempDir("", "path")
		Expect(err).NotTo(HaveOccurred())

		logger = lagertest.NewTestLogger("test")
		threadLocker = &fakes.OSThreadLocker{}
		repo, err = namespace.NewRepository(logger, dir, threadLocker)
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
コード例 #4
0
	daemonConfig.Marshal(configFile)
	Expect(configFile.Close()).To(Succeed())

	return configFile.Name()
}

var _ = Describe("Networks", func() {
	var (
		session     *gexec.Session
		address     string
		containerID string
		vni         int
		sandboxName string
		hostAddress string
		spaceID     string
		appID       string
		networkID   string

		logger             *lagertest.TestLogger
		sandboxRepo        namespace.Repository
		containerRepo      namespace.Repository
		containerNamespace namespace.Namespace
	)

	BeforeEach(func() {
		address = fmt.Sprintf("127.0.0.1:%d", 4001+GinkgoParallelNode())
		sandboxRepoDir, err := ioutil.TempDir("", "sandbox")
		Expect(err).NotTo(HaveOccurred())

		logger = lagertest.NewTestLogger("test")
		threadLocker := &ossupport.OSLocker{}