github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/apiserver/facades/client/controller/export_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package controller 5 6 import ( 7 "github.com/juju/juju/apiserver/facade" 8 "github.com/juju/juju/core/migration" 9 "github.com/juju/juju/state" 10 ) 11 12 type patcher interface { 13 PatchValue(destination, source interface{}) 14 } 15 16 func SetPrecheckResult(p patcher, err error) { 17 p.PatchValue(&runMigrationPrechecks, func(*state.State, *state.State, *migration.TargetInfo, facade.Presence) error { 18 return err 19 }) 20 } 21 22 func NewControllerAPIForTest(backend Backend) *ControllerAPI { 23 return &ControllerAPI{state: backend} 24 } 25 26 var ( 27 NewControllerAPIv11 = newControllerAPIv11 28 )