github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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  		APIAddresses: []string{"a1:123", "a2:123"},
    18  	}, nil
    19  }
    20  
    21  func NewTestSimpleContext(agentConfig agent.Config, logDir string, data *svctesting.FakeServiceData) *SimpleContext {
    22  	return &SimpleContext{
    23  		api:         &fakeAPI{},
    24  		agentConfig: agentConfig,
    25  		discoverService: func(name string, conf common.Conf) (deployerService, error) {
    26  			svc := svctesting.NewFakeService(name, conf)
    27  			svc.FakeServiceData = data
    28  			return svc, nil
    29  		},
    30  		listServices: func() ([]string, error) {
    31  			return data.InstalledNames(), nil
    32  		},
    33  	}
    34  }