Ejemplo n.º 1
0
func putFile(c *gc.C, stor storage.StorageWriter, name string, contents []byte) error {
	c.Logf("check putting file %s ...", name)
	reader := &readerWithClose{bytes.NewBuffer(contents), false}
	err := stor.Put(name, reader, int64(len(contents)))
	c.Assert(reader.closeCalled, jc.IsFalse)
	return err
}
Ejemplo n.º 2
0
func checkPutFile(c *gc.C, stor storage.StorageWriter, name string, contents []byte) {
	err := stor.Put(name, bytes.NewBuffer(contents), int64(len(contents)))
	c.Assert(err, gc.IsNil)
}
Ejemplo n.º 3
0
// putState writes the given data to the state file on the given storage.
// The file's name is as defined in StateFile.
func putState(stor storage.StorageWriter, data []byte) error {
	logger.Debugf("putting %q to bootstrap storage %T", StateFile, stor)
	return stor.Put(StateFile, bytes.NewBuffer(data), int64(len(data)))
}