github.com/mwhudson/juju@v0.0.0-20160512215208-90ff01f3497f/cmd/jujud/agent/unit/manifolds_test.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package unit_test 5 6 import ( 7 jc "github.com/juju/testing/checkers" 8 gc "gopkg.in/check.v1" 9 10 "github.com/juju/juju/agent" 11 "github.com/juju/juju/cmd/jujud/agent/unit" 12 "github.com/juju/juju/testing" 13 ) 14 15 type ManifoldsSuite struct { 16 testing.BaseSuite 17 } 18 19 var _ = gc.Suite(&ManifoldsSuite{}) 20 21 func (s *ManifoldsSuite) TestStartFuncs(c *gc.C) { 22 manifolds := unit.Manifolds(unit.ManifoldsConfig{ 23 Agent: fakeAgent{}, 24 }) 25 26 for name, manifold := range manifolds { 27 c.Logf("checking %q manifold", name) 28 c.Check(manifold.Start, gc.NotNil) 29 } 30 } 31 32 func (s *ManifoldsSuite) TestManifoldNames(c *gc.C) { 33 config := unit.ManifoldsConfig{ 34 Agent: nil, 35 LogSource: nil, 36 LeadershipGuarantee: 0, 37 } 38 39 manifolds := unit.Manifolds(config) 40 expectedKeys := []string{ 41 "agent", 42 "machine-lock", 43 "api-config-watcher", 44 "api-caller", 45 "log-sender", 46 "upgrader", 47 "migration-fortress", 48 "migration-minion", 49 "logging-config-updater", 50 "proxy-config-updater", 51 "api-address-updater", 52 "charm-dir", 53 "leadership-tracker", 54 "hook-retry-strategy", 55 "uniter", 56 "metric-spool", 57 "meter-status", 58 "metric-collect", 59 "metric-sender", 60 } 61 keys := make([]string, 0, len(manifolds)) 62 for k := range manifolds { 63 keys = append(keys, k) 64 } 65 c.Assert(expectedKeys, jc.SameContents, keys) 66 } 67 68 type fakeAgent struct { 69 agent.Agent 70 }