Documentation ¶
Index ¶
- Variables
- func AssertBaseEntity(c *gc.C, db *mgo.Collection, expect *mongodoc.BaseEntity)
- func AssertEntity(c *gc.C, db *mgo.Collection, expect *mongodoc.Entity)
- func JSONReader(v interface{}) io.Reader
- func MongoJSEnabled() bool
- func MustMarshalJSON(v interface{}) []byte
- type BaseEntityBuilder
- type ElasticSearchSuite
- func (s *ElasticSearchSuite) LoadESConfig(index string, settings, mapping interface{}) error
- func (s *ElasticSearchSuite) NewIndex(c *gc.C) string
- func (s *ElasticSearchSuite) SetUpSuite(c *gc.C)
- func (s *ElasticSearchSuite) SetUpTest(c *gc.C)
- func (s *ElasticSearchSuite) TearDownSuite(c *gc.C)
- func (s *ElasticSearchSuite) TearDownTest(c *gc.C)
- type EntityBuilder
- type IsolatedMgoESSuite
- type IsolatedMgoSuite
Constants ¶
This section is empty.
Variables ¶
var Charms = testing.NewRepo("charm-repo", "quantal")
Functions ¶
func AssertBaseEntity ¶
func AssertBaseEntity(c *gc.C, db *mgo.Collection, expect *mongodoc.BaseEntity)
AssertBaseEntity checks that db contains a base entity that matches expect.
func AssertEntity ¶
AssertEntity checks that db contains an entity that matches expect.
func JSONReader ¶
JSONReader creates an io.Reader which can read the Marshalled value of v.
func MongoJSEnabled ¶
func MongoJSEnabled() bool
MongoJSEnabled reports whether testing code should run tests that rely on JavaScript inside MongoDB.
func MustMarshalJSON ¶
func MustMarshalJSON(v interface{}) []byte
MustMarshalJSON marshals the specified value using json.Marshal and returns the corresponding byte slice. If there is an error marshalling the value then MustMarshalJSON will panic.
Types ¶
type BaseEntityBuilder ¶
type BaseEntityBuilder struct {
// contains filtered or unexported fields
}
BaseEntityBuilder provides a convenient way to describe a mongodoc.BaseEntity for tests that is correctly formed and contains the desired information.
func NewBaseEntity ¶
func NewBaseEntity(url string) BaseEntityBuilder
NewBaseEntity creates a new BaseEntityBuilder for the provided URL.
func (BaseEntityBuilder) Build ¶
func (b BaseEntityBuilder) Build() *mongodoc.BaseEntity
Build creates a mongodoc.BaseEntity from the BaseEntityBuilder.
func (BaseEntityBuilder) WithPromulgated ¶
func (b BaseEntityBuilder) WithPromulgated(promulgated bool) BaseEntityBuilder
WithPromulgated sets the promulgated flag on the BaseEntity.
type ElasticSearchSuite ¶
type ElasticSearchSuite struct { ES *elasticsearch.Database TestIndex string // contains filtered or unexported fields }
ElasticSearchSuite defines a test suite that connects to an elastic-search server. The address of the server depends on the value of the JUJU_TEST_ELASTICSEARCH environment variable, which can be "none" (do not start or connect to a server) or host:port holding the address and port of the server to connect to. If JUJU_TEST_ELASTICSEARCH is not specified then localhost:9200 will be used.
func (*ElasticSearchSuite) LoadESConfig ¶
func (s *ElasticSearchSuite) LoadESConfig(index string, settings, mapping interface{}) error
LoadESConfig loads a canned test configuration to the specified index
func (*ElasticSearchSuite) NewIndex ¶
func (s *ElasticSearchSuite) NewIndex(c *gc.C) string
NewIndex creates a new index name and ensures that it will be cleaned up at end of the test.
func (*ElasticSearchSuite) SetUpSuite ¶
func (s *ElasticSearchSuite) SetUpSuite(c *gc.C)
func (*ElasticSearchSuite) SetUpTest ¶
func (s *ElasticSearchSuite) SetUpTest(c *gc.C)
func (*ElasticSearchSuite) TearDownSuite ¶
func (s *ElasticSearchSuite) TearDownSuite(c *gc.C)
func (*ElasticSearchSuite) TearDownTest ¶
func (s *ElasticSearchSuite) TearDownTest(c *gc.C)
type EntityBuilder ¶
type EntityBuilder struct {
// contains filtered or unexported fields
}
EntityBuilder provides a convenient way to describe a mongodoc.Entity for tests that is correctly formed and contains the desired information.
func NewEntity ¶
func NewEntity(url string) EntityBuilder
NewEntity creates a new EntityBuilder for the provided URL.
func (EntityBuilder) Build ¶
func (b EntityBuilder) Build() *mongodoc.Entity
Build creates a mongodoc.Entity from the EntityBuilder.
func (EntityBuilder) WithPromulgatedURL ¶
func (b EntityBuilder) WithPromulgatedURL(url string) EntityBuilder
WithPromulgatedURL sets the PromulgatedURL and PromulgatedRevision of the entity being built.
type IsolatedMgoESSuite ¶
type IsolatedMgoESSuite struct { jujutesting.IsolationSuite jujutesting.MgoSuite ElasticSearchSuite }
func (*IsolatedMgoESSuite) SetUpSuite ¶
func (s *IsolatedMgoESSuite) SetUpSuite(c *gc.C)
func (*IsolatedMgoESSuite) SetUpTest ¶
func (s *IsolatedMgoESSuite) SetUpTest(c *gc.C)
func (*IsolatedMgoESSuite) TearDownSuite ¶
func (s *IsolatedMgoESSuite) TearDownSuite(c *gc.C)
func (*IsolatedMgoESSuite) TearDownTest ¶
func (s *IsolatedMgoESSuite) TearDownTest(c *gc.C)
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)