Documentation ¶
Index ¶
- type Charm
- type CharmSpec
- type IsolatedMgoSuite
- type MockCharmStore
- func (s *MockCharmStore) AuthAttrs() string
- func (s *MockCharmStore) DefaultSeries() string
- func (s *MockCharmStore) Get(charmURL *charm.URL) (charm.Charm, error)
- func (s *MockCharmStore) Latest(charmURLs ...*charm.URL) ([]charmrepo.CharmRevision, error)
- func (s *MockCharmStore) Resolve(ref *charm.Reference) (*charm.URL, error)
- func (s *MockCharmStore) SetAuthAttrs(auth string)
- func (s *MockCharmStore) SetCharm(charmURL *charm.URL, archive *charm.CharmArchive) error
- func (s *MockCharmStore) SetDefaultSeries(series string)
- func (s *MockCharmStore) TestMode() bool
- func (s *MockCharmStore) WithTestMode(testMode bool) charmrepo.Interface
- type MockStore
- type Repo
- 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 ¶
This section is empty.
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 (*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) 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 MockCharmStore ¶
type MockCharmStore struct {
// contains filtered or unexported fields
}
MockCharmStore implements charm/charmrepo.Interface and is used to isolate tests that would otherwise need to hit the real charm store.
func NewMockCharmStore ¶
func NewMockCharmStore() *MockCharmStore
func (*MockCharmStore) AuthAttrs ¶
func (s *MockCharmStore) AuthAttrs() string
AuthAttrs returns the AuthAttrs for this charm store.
func (*MockCharmStore) DefaultSeries ¶
func (s *MockCharmStore) DefaultSeries() string
DefaultSeries returns the default series for this charm store.
func (*MockCharmStore) Get ¶
func (s *MockCharmStore) Get(charmURL *charm.URL) (charm.Charm, error)
Get implements charm/charmrepo.Interface.Get.
func (*MockCharmStore) Latest ¶
func (s *MockCharmStore) Latest(charmURLs ...*charm.URL) ([]charmrepo.CharmRevision, error)
Latest implements charm/charmrepo.Interface.Latest.
func (*MockCharmStore) Resolve ¶
func (s *MockCharmStore) Resolve(ref *charm.Reference) (*charm.URL, error)
Resolve implements charm/charmrepo.Interface.Resolve.
func (*MockCharmStore) SetAuthAttrs ¶
func (s *MockCharmStore) SetAuthAttrs(auth string)
SetAuthAttrs overwrites the value returned by AuthAttrs
func (*MockCharmStore) SetCharm ¶
func (s *MockCharmStore) SetCharm(charmURL *charm.URL, archive *charm.CharmArchive) error
SetCharm adds and removes charms in s. The affected charm is identified by charmURL, which must be revisioned. If archive is nil, the charm will be removed; otherwise, it will be stored. It is an error to store a archive under a charmURL that does not share its name and revision.
func (*MockCharmStore) SetDefaultSeries ¶
func (s *MockCharmStore) SetDefaultSeries(series string)
SetDefaultSeries overwrites the default series for this charm store.
func (*MockCharmStore) TestMode ¶
func (s *MockCharmStore) TestMode() bool
TestMode returns the test mode setting of this charm store.
func (*MockCharmStore) WithTestMode ¶
func (s *MockCharmStore) WithTestMode(testMode bool) charmrepo.Interface
WithTestMode returns a repository Interface where testMode is set to value passed to this method.
type MockStore ¶
type MockStore struct { 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) 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.