diff --git a/api/package_test.go b/api/package_test.go index f13141ffa27..b84f687fb1a 100644 --- a/api/package_test.go +++ b/api/package_test.go @@ -28,6 +28,7 @@ func (*ImportSuite) TestImports(c *gc.C) { "api/base", "api/watcher", "core/arch", + "core/backups", "core/base", "core/constraints", "core/database", diff --git a/apiserver/facades/controller/migrationtarget/migrationtarget_test.go b/apiserver/facades/controller/migrationtarget/migrationtarget_test.go index eb87fe2fb75..363eada43c7 100644 --- a/apiserver/facades/controller/migrationtarget/migrationtarget_test.go +++ b/apiserver/facades/controller/migrationtarget/migrationtarget_test.go @@ -81,8 +81,9 @@ func (s *Suite) TestFacadeRegistered(c *gc.C) { c.Assert(err, jc.ErrorIsNil) api, err := aFactory(&facadetest.Context{ - State_: s.State, - Auth_: s.authorizer, + State_: s.State, + Auth_: s.authorizer, + ServiceFactory_: servicefactorytesting.NewTestingServiceFactory(), }) c.Assert(err, jc.ErrorIsNil) c.Assert(api, gc.FitsTypeOf, new(migrationtarget.API)) diff --git a/apiserver/facades/controller/migrationtarget/register.go b/apiserver/facades/controller/migrationtarget/register.go index 835e7322a94..45d7cf6d6ff 100644 --- a/apiserver/facades/controller/migrationtarget/register.go +++ b/apiserver/facades/controller/migrationtarget/register.go @@ -110,5 +110,6 @@ func newFacade(ctx facade.Context, facadeVersions facades.FacadeVersions) (*API, credentialcommon.CredentialInvalidatorGetter(ctx), stateenvirons.GetNewEnvironFunc(environs.New), stateenvirons.GetNewCAASBrokerFunc(caas.New), - facadeVersions) + facadeVersions, + ) } diff --git a/apiserver/facadeversions_test.go b/apiserver/facadeversions_test.go index 159f63afd25..95d1a61f15d 100644 --- a/apiserver/facadeversions_test.go +++ b/apiserver/facadeversions_test.go @@ -10,6 +10,7 @@ import ( "github.com/juju/juju/api" "github.com/juju/juju/apiserver" + "github.com/juju/juju/core/facades" coretesting "github.com/juju/juju/testing" ) @@ -52,24 +53,24 @@ func (s *facadeVersionSuite) TestFacadeVersionsMatchServerVersions(c *gc.C) { c.Check(apiFacadeVersions, jc.DeepEquals, serverFacadeBestVersions) } -// TestClient3xSupport checks that the client facade supports the 3.x for -// certain tasks. You must be very careful when removing support for facades +// TestClientSupport checks that the client facade supports the 3.x and 4.x +// for certain tasks. You must be very careful when removing support for facades // as it can break model migrations, upgrades, and state reports. -func (s *facadeVersionSuite) TestClient3xSupport(c *gc.C) { +func (s *facadeVersionSuite) TestClientSupport(c *gc.C) { tests := []struct { facadeName string summary string - apiClientVersion int + apiClientVersion facades.FacadeVersion }{ { facadeName: "Client", summary: "Ensure that the Client facade supports 3.x for status requests", - apiClientVersion: 6, + apiClientVersion: []int{6}, }, { facadeName: "ModelManager", summary: "Ensure that the ModelManager facade supports 3.x for model migration and status requests", - apiClientVersion: 9, + apiClientVersion: []int{9}, }, } for _, test := range tests { @@ -88,18 +89,17 @@ var Contains gc.Checker = &containsChecker{ } func (checker *containsChecker) Check(params []interface{}, names []string) (result bool, err string) { - expected, ok := params[1].(int) + expected, ok := params[1].(facades.FacadeVersion) if !ok { - return false, "expected must be a string" + return false, "expected must be a int" } - obtained, ok := params[0].([]int) + obtained, ok := params[0].(facades.FacadeVersion) if ok { - for _, v := range obtained { - if v == expected { - return true, "" - } + if set.NewInts(expected...).Intersection(set.NewInts(obtained...)).Size() > 0 { + return true, "" } + return false, "" }