Beispiel #1
0
func (s *cacheFileInterfaceSuite) readCacheFile(c *gc.C) configstore.CacheFile {
	envDir := filepath.Join(s.dir, "models")
	filename := configstore.CacheFilename(envDir)
	cache, err := configstore.ReadCacheFile(filename)
	c.Assert(err, jc.ErrorIsNil)
	return cache
}
Beispiel #2
0
func (s *cacheFileInterfaceSuite) TestServerUUIDWrite(c *gc.C) {
	modelUUID := testing.ModelTag.Id()
	info := s.writeEnv(c, "testing", modelUUID, modelUUID, "tester", "secret")

	// Now make sure the cache file exists and the jenv doesn't
	envDir := filepath.Join(s.dir, "models")
	filename := configstore.CacheFilename(envDir)
	c.Assert(info.Location(), gc.Equals, fmt.Sprintf("file %q", filename))

	cache := s.readCacheFile(c)
	c.Assert(cache.Server, gc.HasLen, 1)
	c.Assert(cache.ServerData, gc.HasLen, 1)
	c.Assert(cache.Environment, gc.HasLen, 1)
}