Documentation ¶
Index ¶
- func FinishMetadata(meta *backups.Metadata)
- func NewArchive(meta *backups.Metadata, files, dump []File) (*bytes.Buffer, error)
- func NewArchiveBasic(meta *backups.Metadata) (*bytes.Buffer, error)
- func NewArchiveV0(meta *backups.Metadata, files, dump []File) (*bytes.Buffer, error)
- func NewMetadata() *backups.Metadata
- func NewMetadataStarted() *backups.Metadata
- func SHA1SumFile(c *gc.C, file *os.File) string
- func SetOrigin(meta *backups.Metadata, modelUUID, machine, hostname string)
- func UpdateNotes(meta *backups.Metadata, notes string) *backups.Metadata
- type BaseSuite
- type FakeBackups
- type File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FinishMetadata ¶
FinishMetadata finishes a metadata with test values.
func NewArchive ¶
NewArchive returns a new archive file containing the files.
func NewArchiveBasic ¶
NewArchiveBasic returns a new archive file with a few files provided.
func NewArchiveV0 ¶
NewArchiveV0 returns a new archive file containing the files, in v0 format.
func NewMetadata ¶
NewMetadata returns a Metadata to use for testing.
func NewMetadataStarted ¶
NewMetadataStarted returns a Metadata to use for testing.
func SHA1SumFile ¶
SHA1SumFile returns the RFC 3230 SHA hash of the file.
Types ¶
type BaseSuite ¶
type BaseSuite struct { testing.IsolationSuite // Meta is a Metadata with standard test values. Meta *backups.Metadata }
BaseSuite is the base suite for backups testing.
type FakeBackups ¶
type FakeBackups struct { // Calls contains the order in which methods were called. Calls []string // Meta holds the Metadata to return. Meta *backups.Metadata // MetaList holds the Metadata list to return. MetaList []*backups.Metadata // Archive holds the archive file to return. Archive io.ReadCloser // Error holds the error to return. Error error // Filename holds the name of the file to return. Filename string // IDArg holds the ID that was passed in. IDArg string // PathsArg holds the Paths that was passed in. PathsArg *backups.Paths // DBInfoArg holds the ConnInfo that was passed in. DBInfoArg *backups.DBInfo // MetaArg holds the backup metadata that was passed in. MetaArg *backups.Metadata // PrivateAddr Holds the address for the internal network of the machine. PrivateAddr string // InstanceId is the id of the machine to be restored. InstanceId instance.Id // ArchiveArg holds the backup archive that was passed in. ArchiveArg io.Reader }
FakeBackups is an implementation of Backups to use for testing. TODO: (hml) 2018-04-25 Let's change FakeBackups to using gomock or base.APICaller. Checking calls made and arguments is a pain.
func (*FakeBackups) Create ¶
func (b *FakeBackups) Create( meta *backups.Metadata, paths *backups.Paths, dbInfo *backups.DBInfo, ) (string, error)
Create creates and stores a new juju backup archive and returns its associated metadata.
func (*FakeBackups) Get ¶
func (b *FakeBackups) Get(id string) (*backups.Metadata, io.ReadCloser, error)
Get returns the metadata and archive file associated with the ID.
type File ¶
type File struct { // Name is the path to which the file will be identified in the archive. Name string // Content is the data that will be written to the archive for the file. Content string // IsDir determines if the file is a regular file or a directory. IsDir bool }
File represents a file during testing.