コード例 #1
0
ファイル: export_test.go プロジェクト: howbazaar/juju
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
		},
	}
}
コード例 #2
0
ファイル: export_test.go プロジェクト: imoapps/juju
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
	})
}