示例#1
0
文件: generator.go 项目: jianhuiz/rep
func New(
	cellID string,
	bbs bbs.Client,
	executorClient executor.Client,
	evacuationReporter evacuation_context.EvacuationReporter,
	evacuationTTLInSeconds uint64,
) Generator {
	containerDelegate := internal.NewContainerDelegate(executorClient)
	lrpProcessor := internal.NewLRPProcessor(bbs, containerDelegate, cellID, evacuationReporter, evacuationTTLInSeconds)
	taskProcessor := internal.NewTaskProcessor(bbs, containerDelegate, cellID)

	return &generator{
		cellID:            cellID,
		bbs:               bbs,
		executorClient:    executorClient,
		lrpProcessor:      lrpProcessor,
		taskProcessor:     taskProcessor,
		containerDelegate: containerDelegate,
	}
}
示例#2
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("ContainerDelegate", func() {
	var containerDelegate internal.ContainerDelegate
	var executorClient *fakes.FakeClient
	var logger *lagertest.TestLogger
	var expectedGuid = "some-instance-guid"
	const sessionPrefix = "test"

	BeforeEach(func() {
		executorClient = new(fakes.FakeClient)
		containerDelegate = internal.NewContainerDelegate(executorClient)
		logger = lagertest.NewTestLogger(sessionPrefix)
	})

	Describe("RunContainer", func() {
		var result bool
		var runRequest executor.RunRequest

		BeforeEach(func() {
			runRequest = executor.NewRunRequest(expectedGuid, &executor.RunInfo{}, executor.Tags{})
		})

		JustBeforeEach(func() {
			result = containerDelegate.RunContainer(logger, &runRequest)
		})