Example #1
0
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_watcher"
	networkFakes "github.com/cloudfoundry-incubator/garden-linux/network/fakes"
	"github.com/cloudfoundry-incubator/garden-linux/port_pool/fake_port_pool"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker/fake_process_tracker"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
	. "github.com/cloudfoundry/gunk/command_runner/fake_command_runner/matchers"
)

var _ = Describe("Linux containers", func() {
	var fakeCgroups *fake_cgroups_manager.FakeCgroupsManager
	var fakeQuotaManager *fake_quota_manager.FakeQuotaManager
	var fakeBandwidthManager *fake_bandwidth_manager.FakeBandwidthManager
	var fakeRunner *fake_command_runner.FakeCommandRunner
	var fakeOomWatcher *fake_watcher.FakeWatcher
	var containerResources *linux_backend.Resources
	var container *linux_container.LinuxContainer
	var containerDir string

	BeforeEach(func() {
		fakeRunner = fake_command_runner.New()

		fakeCgroups = fake_cgroups_manager.New("/cgroups", "some-id")

		fakeQuotaManager = new(fake_quota_manager.FakeQuotaManager)
		fakeBandwidthManager = fake_bandwidth_manager.New()
		fakeOomWatcher = new(fake_watcher.FakeWatcher)

		var err error
		containerDir, err = ioutil.TempDir("", "depot")
		Expect(err).ToNot(HaveOccurred())
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_watcher"
	networkFakes "github.com/cloudfoundry-incubator/garden-linux/network/fakes"
	"github.com/cloudfoundry-incubator/garden-linux/port_pool/fake_port_pool"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker/fake_process_tracker"
	wfakes "github.com/cloudfoundry-incubator/garden/fakes"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
	. "github.com/cloudfoundry/gunk/command_runner/fake_command_runner/matchers"
)

var _ = Describe("Linux containers", func() {
	var fakeCgroups *fake_cgroups_manager.FakeCgroupsManager
	var fakeQuotaManager *fake_quota_manager.FakeQuotaManager
	var fakeBandwidthManager *fake_bandwidth_manager.FakeBandwidthManager
	var fakeRunner *fake_command_runner.FakeCommandRunner
	var containerResources *linux_backend.Resources
	var container *linux_container.LinuxContainer
	var fakePortPool *fake_port_pool.FakePortPool
	var fakeProcessTracker *fake_process_tracker.FakeProcessTracker
	var fakeFilter *networkFakes.FakeFilter
	var fakeOomWatcher *fake_watcher.FakeWatcher
	var containerDir string
	var containerProps map[string]string

	BeforeEach(func() {
		fakeRunner = fake_command_runner.New()

		fakeCgroups = fake_cgroups_manager.New("/cgroups", "some-id")

		fakeQuotaManager = new(fake_quota_manager.FakeQuotaManager)
		fakeBandwidthManager = fake_bandwidth_manager.New()
		fakeProcessTracker = new(fake_process_tracker.FakeProcessTracker)
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker/fake_process_tracker"
	wfakes "github.com/cloudfoundry-incubator/garden/fakes"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
	. "github.com/cloudfoundry/gunk/command_runner/fake_command_runner/matchers"
)

var _ = Describe("Linux containers", func() {
	var (
		fakeCgroups          *fake_cgroups_manager.FakeCgroupsManager
		fakeQuotaManager     *fake_quota_manager.FakeQuotaManager
		fakeBandwidthManager *fake_bandwidth_manager.FakeBandwidthManager
		fakeRunner           *fake_command_runner.FakeCommandRunner
		containerResources   *linux_backend.Resources
		container            *linux_container.LinuxContainer
		fakePortPool         *fake_port_pool.FakePortPool
		fakeProcessTracker   *fake_process_tracker.FakeProcessTracker
		fakeFilter           *networkFakes.FakeFilter
		fakeOomWatcher       *fake_watcher.FakeWatcher
		containerDir         string
		containerProps       map[string]string
		containerVersion     semver.Version
		fakeIPTablesManager  *fake_iptables_manager.FakeIPTablesManager
	)

	netOutRule1 := garden.NetOutRule{
		Protocol: garden.ProtocolUDP,
		Networks: []garden.IPRange{garden.IPRangeFromIP(net.ParseIP("1.2.3.4"))},
		Ports:    []garden.PortRange{{Start: 12, End: 24}},
		ICMPs:    &garden.ICMPControl{Type: 3, Code: garden.ICMPControlCode(12)},
		Log:      true,
	}
Example #4
0
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/bandwidth_manager/fake_bandwidth_manager"
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/cgroups_manager/fake_cgroups_manager"
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_network_statisticser"
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_quota_manager"
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_watcher"
	networkFakes "github.com/cloudfoundry-incubator/garden-linux/network/fakes"
	"github.com/cloudfoundry-incubator/garden-linux/port_pool/fake_port_pool"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker/fake_process_tracker"
	wfakes "github.com/cloudfoundry-incubator/garden/fakes"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
)

var _ = Describe("Linux containers", func() {
	var containerResources *linux_backend.Resources
	var container *linux_container.LinuxContainer
	var fakeProcessTracker *fake_process_tracker.FakeProcessTracker
	var logger *lagertest.TestLogger
	var containerDir string
	var containerVersion semver.Version

	BeforeEach(func() {
		fakeProcessTracker = new(fake_process_tracker.FakeProcessTracker)
		containerVersion = semver.Version{Major: 1, Minor: 0, Patch: 0}

		var err error
		containerDir, err = ioutil.TempDir("", "depot")
		Expect(err).ToNot(HaveOccurred())

		_, subnet, _ := net.ParseCIDR("2.3.4.0/30")
		containerResources = linux_backend.NewResources(
Example #5
0
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_quota_manager"
	"github.com/cloudfoundry-incubator/garden-linux/linux_container/fake_watcher"
	networkFakes "github.com/cloudfoundry-incubator/garden-linux/network/fakes"
	"github.com/cloudfoundry-incubator/garden-linux/port_pool/fake_port_pool"
	"github.com/cloudfoundry-incubator/garden-linux/process_tracker/fake_process_tracker"
	"github.com/cloudfoundry/gunk/command_runner/fake_command_runner"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Linux containers", func() {
	var fakeCgroups *fake_cgroups_manager.FakeCgroupsManager
	var fakeQuotaManager *fake_quota_manager.FakeQuotaManager
	var fakeNetStats *fake_network_statisticser.FakeNetworkStatisticser
	var container *linux_container.LinuxContainer
	var containerDir string

	BeforeEach(func() {
		fakeCgroups = fake_cgroups_manager.New("/cgroups", "some-id")
		fakeQuotaManager = new(fake_quota_manager.FakeQuotaManager)
		fakeNetStats = new(fake_network_statisticser.FakeNetworkStatisticser)
	})

	JustBeforeEach(func() {
		_, subnet, _ := net.ParseCIDR("2.3.4.0/30")
		containerResources := linux_backend.NewResources(
			1235,
			&linux_backend.Network{
				IP:     net.ParseIP("1.2.3.4"),
				Subnet: subnet,