Ejemplo n.º 1
0
func NewTestSimpleContext(agentConfig agent.Config, logDir string, data *svctesting.FakeServiceData) *SimpleContext {
	return &SimpleContext{
		api:         &fakeAPI{},
		agentConfig: agentConfig,
		discoverService: func(name string, conf common.Conf) (deployerService, error) {
			svc := svctesting.NewFakeService(name, conf)
			svc.FakeServiceData = data
			return svc, nil
		},
		listServices: func() ([]string, error) {
			return data.InstalledNames(), nil
		},
	}
}
Ejemplo n.º 2
0
func PatchServices(patchValue func(interface{}, interface{}), data *svctesting.FakeServiceData) {
	patchValue(&mongoRemoveService, func(namespace string) error {
		data.AddCall("RemoveService", namespace)
		data.SetStatus(mongo.ServiceName(namespace), "")
		return data.NextErr()
	})
	patchValue(&discoverService, func(name string) (agentService, error) {
		return NewService(name, common.Conf{}, data), nil
	})
}