// putFakeTools sets up a bucket containing something // that looks like a tools archive so test methods // that start an instance can succeed even though they // do not upload tools. func putFakeTools(c *C, s environs.StorageWriter) { path := environs.ToolsStoragePath(version.Current) c.Logf("putting fake tools at %v", path) toolsContents := "tools archive, honest guv" err := s.Put(path, strings.NewReader(toolsContents), int64(len(toolsContents))) c.Assert(err, IsNil) }
func checkPutFile(c *C, storage environs.StorageWriter, name string, contents []byte) { c.Logf("check putting file %s ...", name) reader := &readerWithClose{bytes.NewBuffer(contents), false} err := storage.Put(name, reader, int64(len(contents))) c.Assert(err, IsNil) c.Assert(reader.closeCalled, jc.IsFalse) }
// putFakeTools writes something // that looks like a tools archive so Bootstrap can // find some tools and initialise the state correctly. func putFakeTools(s environs.StorageWriter) { log.Printf("environs/dummy: putting fake tools") path := environs.ToolsStoragePath(version.Current) toolsContents := "tools archive, honest guv" err := s.Put(path, strings.NewReader(toolsContents), int64(len(toolsContents))) if err != nil { panic(err) } }
func checkPutFile(c *C, storage environs.StorageWriter, name string, contents []byte) { err := storage.Put(name, bytes.NewBuffer(contents), int64(len(contents))) c.Assert(err, IsNil) }