Documentation ¶
Index ¶
- func MetaWithRelations(m *charm.Meta, relations ...string) *charm.Meta
- func MetaWithResources(m *charm.Meta, resources ...string) *charm.Meta
- func MetaWithSupportedSeries(m *charm.Meta, series ...string) *charm.Meta
- type Charm
- func (ch *Charm) Actions() *charm.Actions
- func (ch *Charm) Archive() *charm.CharmArchive
- func (ch *Charm) ArchiveBytes() []byte
- func (c *Charm) ArchiveTo(w io.Writer) error
- func (ch *Charm) Config() *charm.Config
- func (ch *Charm) Meta() *charm.Meta
- func (ch *Charm) Metrics() *charm.Metrics
- func (ch *Charm) Revision() int
- func (c *Charm) Size() int64
- type CharmSpec
- type IsolatedMgoSuite
- type MockStore
- type Repo
- func (r *Repo) BundleArchive(dst, name string) *charm.BundleArchive
- func (r *Repo) BundleArchivePath(dst, name string) string
- func (r *Repo) BundleDir(name string) *charm.BundleDir
- func (r *Repo) BundleDirPath(name string) string
- func (r *Repo) CharmArchive(dst, name string) *charm.CharmArchive
- func (r *Repo) CharmArchivePath(dst, name string) string
- func (r *Repo) CharmDir(name string) *charm.CharmDir
- func (r *Repo) CharmDirPath(name string) string
- func (r *Repo) ClonedBundleDirPath(dst, name string) string
- func (r *Repo) ClonedDir(dst, name string) *charm.CharmDir
- func (r *Repo) ClonedDirPath(dst, name string) string
- func (r *Repo) ClonedURL(dst, series, name string) *charm.URL
- func (r *Repo) Path() string
- func (r *Repo) RenamedClonedDirPath(dst, name, newName string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetaWithRelations ¶
func MetaWithRelations(m *charm.Meta, relations ...string) *charm.Meta
MetaWithRelations returns m with Provides and Requires set to the given relations, where each relation is specified as a white-space-separated triple:
role name interface
where role specifies the role of the interface ("provides" or "requires"), name holds the relation name and interface holds the interface relation type.
If m is nil, new(charm.Meta) will be used instead.
func MetaWithResources ¶
func MetaWithResources(m *charm.Meta, resources ...string) *charm.Meta
MetaWithResources returns m with Resources set to a set of resources with the given names. If m is nil, new(charm.Meta) will be used instead.
The path and description of the resources are derived from the resource name by adding a "-file" and a " description" suffix respectively.
func MetaWithSupportedSeries ¶
func MetaWithSupportedSeries(m *charm.Meta, series ...string) *charm.Meta
MetaWithSupportedSeries returns m with Series set to series. If m is nil, new(charm.Meta) will be used instead.
Types ¶
type Charm ¶
type Charm struct {
// contains filtered or unexported fields
}
Charm holds a charm for testing. It does not have a representation on disk by default, but can be written to disk using Archive and its ExpandTo method. It implements the charm.Charm interface.
All methods on Charm may be called concurrently.
func NewCharmMeta ¶
func NewCharmMeta(meta *charm.Meta) *Charm
NewCharmMeta returns a charm with the given metadata. It doesn't take a *gc.C, so it can be used at init time, for example in table-driven tests.
func (*Charm) Actions ¶
func (ch *Charm) Actions() *charm.Actions
Actions implements charm.Charm.Actions.
func (*Charm) Archive ¶
func (ch *Charm) Archive() *charm.CharmArchive
Archive returns a charm archive holding the charm.
func (*Charm) ArchiveBytes ¶
ArchiveBytes returns the contents of the charm archive holding the charm.
func (*Charm) ArchiveTo ¶
ArchiveTo implements ArchiveTo as implemented by *charm.Dir, enabling the charm to be used in some APIs that check for that method.
func (*Charm) Config ¶
func (ch *Charm) Config() *charm.Config
Config implements charm.Charm.Config.
type CharmSpec ¶
type CharmSpec struct { // Meta holds the contents of metadata.yaml. Meta string // Config holds the contents of config.yaml. Config string // Actions holds the contents of actions.yaml. Actions string // Metrics holds the contents of metrics.yaml. Metrics string // Files holds any additional files that should be // added to the charm. If this is nil, a minimal set // of files will be added to ensure the charm is readable. Files []filetesting.Entry // Revision specifies the revision of the charm. Revision int }
CharmSpec holds the specification for a charm. The fields hold data in YAML format.
type IsolatedMgoSuite ¶
type IsolatedMgoSuite struct { jujutesting.IsolationSuite jujutesting.MgoSuite }
func (*IsolatedMgoSuite) SetUpSuite ¶
func (s *IsolatedMgoSuite) SetUpSuite(c *gc.C)
func (*IsolatedMgoSuite) SetUpTest ¶
func (s *IsolatedMgoSuite) SetUpTest(c *gc.C)
func (*IsolatedMgoSuite) TearDownSuite ¶
func (s *IsolatedMgoSuite) TearDownSuite(c *gc.C)
func (*IsolatedMgoSuite) TearDownTest ¶
func (s *IsolatedMgoSuite) TearDownTest(c *gc.C)
type MockStore ¶
type MockStore struct { // ArchiveSHA256 holds the hex-encoded SHA256 checksum // of the charm archive served by the mock store. ArchiveSHA256 string Downloads []*charm.URL DownloadsNoStats []*charm.URL Authorizations []string Metadata []string InfoRequestCount int InfoRequestCountNoStats int DefaultSeries string // contains filtered or unexported fields }
MockStore provides a mock charm store implementation useful when testing.
func NewMockStore ¶
NewMockStore creates a mock charm store containing the specified charms.
func (*MockStore) ServeHTTP ¶
func (s *MockStore) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.ServeHTTP
func (*MockStore) UpdateStoreRevision ¶
UpdateStoreRevision sets the revision of the specified charm to rev.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo represents a charm repository used for testing.
func NewRepo ¶
NewRepo returns a new testing charm repository rooted at the given path, relative to the package directory of the calling package, using defaultSeries as the default series.
func (*Repo) BundleArchive ¶
BundleArchive returns an actual charm.BundleArchive created from a new bundle archive file created from the bundle directory named name, in the directory dst.
func (*Repo) BundleArchivePath ¶
BundleArchivePath returns the path to a new bundle archive file in the directory dst, created from the bundle directory named name.
func (*Repo) BundleDirPath ¶
BundleDirPath returns the path to a bundle directory with the given name in the default series
func (*Repo) CharmArchive ¶
CharmArchive returns an actual charm.CharmArchive created from a new charm archive file created from the charm directory named name, in the directory dst.
func (*Repo) CharmArchivePath ¶
CharmArchivePath returns the path to a new charm archive file in the directory dst, created from the charm directory named name.
func (*Repo) CharmDirPath ¶
CharmDirPath returns the path to a charm directory with the given name in the default series
func (*Repo) ClonedBundleDirPath ¶
ClonedDirPath returns the path to a new copy of the default bundle directory named name.
func (*Repo) ClonedDir ¶
ClonedDir returns an actual charm.CharmDir based on a new copy of the charm directory named name, in the directory dst.
func (*Repo) ClonedDirPath ¶
ClonedDirPath returns the path to a new copy of the default charm directory named name.
func (*Repo) ClonedURL ¶
ClonedURL makes a copy of the charm directory. It will create a directory with the series name if it does not exist, and then clone the charm named name into that directory. The return value is a URL pointing at the local charm.
func (*Repo) RenamedClonedDirPath ¶
RenamedClonedDirPath returns the path to a new copy of the default charm directory named name, renamed to newName.