juju: github.com/juju/juju/testcharms Index | Files

package testcharms

import "github.com/juju/juju/testcharms"

Package testcharms holds a corpus of charms for testing.

Index

Package Files

charm.go

Variables

var Repo = testing.NewRepo("charm-repo", defaultSeries)

Repo provides access to the test charm repository.

func CheckCharmReady Uses

func CheckCharmReady(c *gc.C, charmArchive *charm.CharmArchive)

CheckCharmReady ensures that a desired charm archive exists and has some content.

func InjectFilesToCharmArchive Uses

func InjectFilesToCharmArchive(pathToArchive string, fileContents map[string]string) error

InjectFilesToCharmArchive overwrites the contents of pathToArchive with a new archive containing the original files plus the ones provided in the fileContents map (key: file name, value: file contents).

func RepoForSeries Uses

func RepoForSeries(series string) *testing.Repo

RepoForSeries returns a new charm repository for the specified series. Note: this is a bit weird, as it ignores the series if it's NOT kubernetes and falls back to the default series, which makes this pretty pointless.

func RepoWithSeries Uses

func RepoWithSeries(series string) *testing.Repo

RepoWithSeries returns a new charm repository for the specified series.

func SetPublic Uses

func SetPublic(c *gc.C, client CharmstoreClient, id *charm.URL)

SetPublic sets the charm or bundle with the given id to be published with global read permissions to the stable channel.

func SetPublicWithResources Uses

func SetPublicWithResources(c *gc.C, client CharmstoreClient, id *charm.URL, resources map[string]int)

SetPublicWithResources sets the charm or bundle with the given id to be published with global read permissions to the stable channel.

The named resources with their associated revision numbers are also published.

func UploadBundle Uses

func UploadBundle(c *gc.C, client CharmstoreClient, url, name string) (*charm.URL, charm.Bundle)

UploadBundle sets default series to defaultSeries

func UploadBundleWithSeries Uses

func UploadBundleWithSeries(c *gc.C, client CharmstoreClient, url, name, series string) (*charm.URL, charm.Bundle)

UploadBundleWithSeries uploads a bundle using the given charm store client, and returns the resulting bundle URL and bundle.

func UploadCharm Uses

func UploadCharm(c *gc.C, client CharmstoreClient, url, name string) (*charm.URL, charm.Charm)

UploadCharm sets default series to defaultSeries

func UploadCharmMultiSeries Uses

func UploadCharmMultiSeries(c *gc.C, client CharmstoreClient, url, name string) (*charm.URL, charm.Charm)

UploadCharmMultiSeries sets default series to defaultSeries

func UploadCharmMultiSeriesWithSeries Uses

func UploadCharmMultiSeriesWithSeries(c *gc.C, client CharmstoreClient, url, name, series string) (*charm.URL, charm.Charm)

UploadCharmMultiSeriesWithSeries uploads a charm with revision using the given charm store client, and returns the resulting charm URL and charm. This API caters for new multi-series charms which do not specify a series in the URL.

func UploadCharmWithMeta Uses

func UploadCharmWithMeta(c *gc.C, client CharmstoreClient, charmURL, meta, metrics string, revision int) (*charm.URL, charm.Charm)

UploadCharmWithMeta pushes a new charm to the charmstore. The uploaded charm takes the supplied charmURL with metadata.yaml and metrics.yaml to define the charm, rather than relying on the charm to exist on disk. This allows you to create charm definitions directly in yaml and have them uploaded here for us in tests.

For convenience the charm is also made public

func UploadCharmWithSeries Uses

func UploadCharmWithSeries(c *gc.C, client CharmstoreClient, url, name, series string) (*charm.URL, charm.Charm)

UploadCharmWithSeries uploads a charm using the given charm store client, and returns the resulting charm URL and charm.

It also adds any required resources that haven't already been uploaded with the content "<resourcename> content".

type CharmstoreClient Uses

type CharmstoreClient interface {
    // Put enables "raw HTTP" calls
    Put(path string, value interface{}) error
    // Publish publishes an object representable by `id`, which could be a bundle, charm or resource
    Publish(id *charm.URL, channels []params.Channel, resources map[string]int) error
    UploadBundle(id *charm.URL, bundle charm.Bundle) (*charm.URL, error)
    UploadBundleWithRevision(id *charm.URL, bundle charm.Bundle, promulgatedRevision int) error
    UploadCharm(id *charm.URL, charmDetails charm.Charm) (*charm.URL, error)
    UploadCharmWithRevision(id *charm.URL, charmDetails charm.Charm, promulgatedRevision int) error
    UploadResource(id *charm.URL, name, path string, file io.ReaderAt, size int64, progress csclient.Progress) (revision int, err error)
    ListResources(id *charm.URL) ([]params.Resource, error)
    AddDockerResource(id *charm.URL, resourceName string, imageName, digest string) (revision int, err error)
    WithChannel(channel params.Channel) CharmstoreClient
}

CharmstoreClient bridges a charmstore and Juju

Only methods that are relied upon by the testcharms package are exposed here.

Package testcharms imports 14 packages (graph) and is imported by 170 packages. Updated 2019-10-17. Refresh now. Tools for package owners.