. "github.com/pivotal-cf-experimental/garden/command_runner/fake_command_runner/matchers"
	"github.com/pivotal-cf-experimental/garden/linux_backend"
	"github.com/pivotal-cf-experimental/garden/linux_backend/bandwidth_manager/fake_bandwidth_manager"
	"github.com/pivotal-cf-experimental/garden/linux_backend/cgroups_manager/fake_cgroups_manager"
	"github.com/pivotal-cf-experimental/garden/linux_backend/network_pool"
	"github.com/pivotal-cf-experimental/garden/linux_backend/port_pool/fake_port_pool"
	"github.com/pivotal-cf-experimental/garden/linux_backend/quota_manager/fake_quota_manager"
)

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_backend.LinuxContainer
var fakePortPool *fake_port_pool.FakePortPool

var _ = Describe("Linux containers", func() {
	BeforeEach(func() {
		fakeRunner = fake_command_runner.New()

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

		fakeQuotaManager = fake_quota_manager.New()
		fakeBandwidthManager = fake_bandwidth_manager.New()

		_, ipNet, err := net.ParseCIDR("10.254.0.0/24")
		Expect(err).ToNot(HaveOccurred())

		fakePortPool = fake_port_pool.New(1000)
	. "github.com/pivotal-cf-experimental/garden/command_runner/fake_command_runner/matchers"
	"github.com/pivotal-cf-experimental/garden/linux_backend"
	"github.com/pivotal-cf-experimental/garden/linux_backend/container_pool"
	"github.com/pivotal-cf-experimental/garden/linux_backend/network"
	"github.com/pivotal-cf-experimental/garden/linux_backend/network_pool/fake_network_pool"
	"github.com/pivotal-cf-experimental/garden/linux_backend/port_pool/fake_port_pool"
	"github.com/pivotal-cf-experimental/garden/linux_backend/quota_manager/fake_quota_manager"
	"github.com/pivotal-cf-experimental/garden/linux_backend/uid_pool/fake_uid_pool"
)

var _ = Describe("Container pool", func() {
	var fakeRunner *fake_command_runner.FakeCommandRunner
	var fakeUIDPool *fake_uid_pool.FakeUIDPool
	var fakeNetworkPool *fake_network_pool.FakeNetworkPool
	var fakeQuotaManager *fake_quota_manager.FakeQuotaManager
	var fakePortPool *fake_port_pool.FakePortPool
	var pool *container_pool.LinuxContainerPool

	BeforeEach(func() {
		_, ipNet, err := net.ParseCIDR("1.2.0.0/20")
		Expect(err).ToNot(HaveOccurred())

		fakeUIDPool = fake_uid_pool.New(10000)

		fakeNetworkPool = fake_network_pool.New(ipNet)
		fakeRunner = fake_command_runner.New()
		fakeQuotaManager = fake_quota_manager.New()
		fakePortPool = fake_port_pool.New(1000)

		pool = container_pool.New(
			"/root/path",