コード例 #1
0
ファイル: worker_test.go プロジェクト: ACPK/atc
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/clock/fakeclock"
	"github.com/pivotal-golang/lager"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Worker", func() {
	var (
		logger                 *lagertest.TestLogger
		fakeGardenClient       *gfakes.FakeClient
		fakeBaggageclaimClient *bfakes.FakeClient
		fakeVolumeFactory      *wfakes.FakeVolumeFactory
		fakeGardenWorkerDB     *wfakes.FakeGardenWorkerDB
		fakeWorkerProvider     *wfakes.FakeWorkerProvider
		fakeClock              *fakeclock.FakeClock
		activeContainers       int
		resourceTypes          []atc.WorkerResourceType
		platform               string
		tags                   []string
		name                   string

		worker Worker
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		fakeGardenClient = new(gfakes.FakeClient)
		fakeBaggageclaimClient = new(bfakes.FakeClient)
		fakeVolumeFactory = new(wfakes.FakeVolumeFactory)
		fakeGardenWorkerDB = new(wfakes.FakeGardenWorkerDB)
		fakeWorkerProvider = new(wfakes.FakeWorkerProvider)
コード例 #2
0
ファイル: checker_test.go プロジェクト: snowsnail/executor
	gardenFakes "github.com/cloudfoundry-incubator/garden/fakes"
	"github.com/pivotal-golang/lager/lagertest"

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

var _ = Describe("Checker", func() {
	const (
		retryCount         = 3
		rootfsPath         = "test-rootfs-path"
		containerOwnerName = "container-owner"
	)
	var (
		gardenChecker   gardenhealth.Checker
		gardenClient    *gardenFakes.FakeClient
		healthcheckSpec garden.ProcessSpec
		logger          *lagertest.TestLogger
	)

	BeforeEach(func() {
		healthcheckSpec = garden.ProcessSpec{
			Path: "/bin/sh",
			Args: []string{"-c", "echo", "hello"},
			User: "******",
		}
		logger = lagertest.NewTestLogger("test")
		gardenClient = &gardenFakes.FakeClient{}
		guidGenerator := &fakeguidgen.FakeGenerator{}
		guidGenerator.GuidReturns("abc-123")
		gardenChecker = gardenhealth.NewChecker(rootfsPath, containerOwnerName, 0, healthcheckSpec, gardenClient, guidGenerator)
	})
コード例 #3
0
ファイル: heartbeater_test.go プロジェクト: savaki/gate
)

var _ = Describe("Heartbeater", func() {
	type registration struct {
		worker atc.Worker
		ttl    time.Duration
	}

	var (
		logger lager.Logger

		addrToRegister string
		interval       time.Duration
		resourceTypes  []atc.WorkerResourceType

		expectedWorker atc.Worker

		fakeGardenClient *gfakes.FakeClient
		fakeATC          *ghttp.Server

		heartbeater ifrit.Process

		registrations <-chan registration
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")

		addrToRegister = "1.2.3.4:7777"
		interval = time.Second
		resourceTypes = []atc.WorkerResourceType{
			{
コード例 #4
0
ファイル: worker_test.go プロジェクト: utako/atc
	"github.com/cloudfoundry-incubator/garden"
	gfakes "github.com/cloudfoundry-incubator/garden/fakes"
	"github.com/concourse/atc"
	. "github.com/concourse/atc/worker"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-golang/clock/fakeclock"
)

var _ = Describe("Worker", func() {
	var (
		fakeGardenClient *gfakes.FakeClient
		fakeClock        *fakeclock.FakeClock
		activeContainers int
		resourceTypes    []atc.WorkerResourceType
		platform         string
		tags             []string

		worker Worker
	)

	BeforeEach(func() {
		fakeGardenClient = new(gfakes.FakeClient)
		fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456))
		activeContainers = 42
		resourceTypes = []atc.WorkerResourceType{
			{Type: "some-resource", Image: "some-resource-image"},
		}
		platform = "some-platform"
		tags = []string{"some", "tags"}
	})