Beispiel #1
0
func PatchService(patchValue func(interface{}, interface{}), data *svctesting.FakeServiceData) {
	patchValue(&discoverService, func(name string) (mongoService, error) {
		svc := svctesting.NewFakeService(name, common.Conf{})
		svc.FakeServiceData = data
		return svc, nil
	})
	patchValue(&newService, func(name string, conf common.Conf) (mongoService, error) {
		svc := svctesting.NewFakeService(name, conf)
		svc.FakeServiceData = data
		return svc, nil
	})
}
Beispiel #2
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
		},
	}
}
Beispiel #3
0
func (s *BaseSuite) SetUpTest(c *gc.C) {
	s.IsolationSuite.SetUpTest(c)

	s.Dirname = c.MkDir()
	s.Name = "juju-agent-machine-0"
	s.Conf = common.Conf{
		Desc:      "some service",
		ExecStart: "/bin/jujud machine 0",
	}
	s.Failure = errors.New("<failed>")

	s.Service = svctesting.NewFakeService(s.Name, s.Conf)
	s.Stub = &s.Service.Stub
	s.Patched = &Stub{Stub: s.Stub}
	s.PatchValue(&discoverService, s.Patched.DiscoverService)
}
Beispiel #4
0
func NewService(name string, conf common.Conf, data *svctesting.FakeServiceData) *svctesting.FakeService {
	svc := svctesting.NewFakeService(name, conf)
	svc.FakeServiceData = data
	return svc
}