github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/core/cache/package_test.go (about) 1 // Copyright 2018 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package cache_test 5 6 import ( 7 "testing" 8 9 "github.com/juju/loggo" 10 "github.com/juju/pubsub" 11 jujutesting "github.com/juju/testing" 12 jc "github.com/juju/testing/checkers" 13 gc "gopkg.in/check.v1" 14 15 "github.com/juju/juju/core/cache" 16 coretesting "github.com/juju/juju/testing" 17 ) 18 19 func TestPackage(t *testing.T) { 20 gc.TestingT(t) 21 } 22 23 // baseSuite is the foundation for test suites in this package. 24 type baseSuite struct { 25 jujutesting.IsolationSuite 26 27 gauges *cache.ControllerGauges 28 } 29 30 func (s *baseSuite) SetUpTest(c *gc.C) { 31 s.IsolationSuite.SetUpTest(c) 32 s.gauges = cache.CreateControllerGauges() 33 } 34 35 // entitySuite is the base suite for testing cached entities 36 // (models, applications, machines). 37 type entitySuite struct { 38 baseSuite 39 40 hub *pubsub.SimpleHub 41 } 42 43 func (s *entitySuite) SetUpTest(c *gc.C) { 44 s.baseSuite.SetUpTest(c) 45 46 logger := loggo.GetLogger("test") 47 logger.SetLogLevel(loggo.TRACE) 48 s.hub = pubsub.NewSimpleHub(&pubsub.SimpleHubConfig{ 49 Logger: logger, 50 }) 51 } 52 53 type ImportSuite struct{} 54 55 var _ = gc.Suite(&ImportSuite{}) 56 57 func (*ImportSuite) TestImports(c *gc.C) { 58 found := coretesting.FindJujuCoreImports(c, "github.com/juju/juju/core/cache") 59 60 // This package only brings in other core packages. 61 c.Assert(found, jc.SameContents, []string{ 62 "core/constraints", 63 "core/instance", 64 "core/life", 65 "core/status", 66 }) 67 }