github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/state/dump_test.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package state_test 5 6 import ( 7 "github.com/juju/collections/set" 8 jc "github.com/juju/testing/checkers" 9 gc "gopkg.in/check.v1" 10 11 "github.com/juju/juju/state" 12 ) 13 14 type dumpSuite struct { 15 ConnSuite 16 } 17 18 var _ = gc.Suite(&dumpSuite{}) 19 20 func (s *dumpSuite) TestDumpAll(c *gc.C) { 21 // Some of the state workers are responsible for creating 22 // collections, so make sure they've started before running 23 // the dump. 24 state.EnsureWorkersStarted(s.State) 25 26 value, err := s.State.DumpAll() 27 c.Assert(err, jc.ErrorIsNil) 28 models, ok := value["models"].(map[string]interface{}) 29 c.Assert(ok, jc.IsTrue) 30 c.Assert(models["name"], gc.Equals, "testmodel") 31 32 initialCollections := set.NewStrings() 33 for name := range value { 34 initialCollections.Add(name) 35 } 36 // check that there are some other collections there 37 c.Check(initialCollections.Contains("modelusers"), jc.IsTrue) 38 c.Check(initialCollections.Contains("statuses"), jc.IsTrue) 39 }