github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/worker/deployer/export_test.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package deployer 5 6 import ( 7 "github.com/juju/juju/agent" 8 "github.com/juju/juju/apiserver/params" 9 "github.com/juju/juju/service/common" 10 svctesting "github.com/juju/juju/service/common/testing" 11 ) 12 13 type fakeAPI struct{} 14 15 func (*fakeAPI) ConnectionInfo() (params.DeployerConnectionValues, error) { 16 return params.DeployerConnectionValues{ 17 StateAddresses: []string{"s1:123", "s2:123"}, 18 APIAddresses: []string{"a1:123", "a2:123"}, 19 }, nil 20 } 21 22 func NewTestSimpleContext(agentConfig agent.Config, logDir string, data *svctesting.FakeServiceData) *SimpleContext { 23 return &SimpleContext{ 24 api: &fakeAPI{}, 25 agentConfig: agentConfig, 26 discoverService: func(name string, conf common.Conf) (deployerService, error) { 27 svc := svctesting.NewFakeService(name, conf) 28 svc.FakeServiceData = data 29 return svc, nil 30 }, 31 listServices: func() ([]string, error) { 32 return data.InstalledNames(), nil 33 }, 34 } 35 }