Documentation ¶
Index ¶
- Variables
- type FakeCollection
- type FakeDB
- type FakeSession
- type MockCollection
- type MockDatabase
- func (db *MockDatabase) AssertExpectations(t mock.TestingT) bool
- func (db *MockDatabase) C(name string) connection.Collection
- func (db *MockDatabase) CollectionNames() ([]string, error)
- func (db *MockDatabase) MockCollection(name string, callCount int) *MockCollection
- func (db *MockDatabase) Run(cmd interface{}, result interface{}) error
- type MockSession
- func (s *MockSession) AssertExpectations(t mock.TestingT) bool
- func (s *MockSession) Close()
- func (s *MockSession) DB(name string) connection.DataLayer
- func (s *MockSession) Info() *connection.Info
- func (s *MockSession) MockDatabase(name string, callCount int) *MockDatabase
- func (s *MockSession) New(host, port string) (connection.Session, error)
Constants ¶
This section is empty.
Variables ¶
var ExpectedInventory = inventory.Items{ "commandline/argv": { "0": "/usr/bin/mongos", "1": "-f", "2": "/etc/mongodb.conf", }, "configuration/config": { "value": "/etc/mongodb.conf", }, "configuration/net.bindIp": { "value": "0.0.0.0", }, "configuration/net.port": { "value": float64(27017), }, "configuration/systemLog.destination": { "value": "file", }, "configuration/systemLog.logRotate": { "value": "rename", }, "parameter/one": { "value": float64(1), }, "parameter/two": { "value": "one, two", }, }
ExpectedInventory is what the inventory should look like using this fake session. It is a combination of "getCmdLineOpts" and "getParameter".
Functions ¶
This section is empty.
Types ¶
type FakeCollection ¶
type FakeCollection struct{}
FakeCollection is a fake collection
func (FakeCollection) FindAll ¶
func (c FakeCollection) FindAll(result interface{}) error
FindAll runs a query on a fake collection
func (FakeCollection) PipeAll ¶
func (c FakeCollection) PipeAll(query, result interface{}) error
PipeAll executes a pipe command and gets all the results
type FakeDB ¶
type FakeDB struct{}
FakeDB is a mocked database
func (FakeDB) CollectionNames ¶
CollectionNames returns a mocked array of collection names
type FakeSession ¶
type FakeSession struct{}
FakeSession is a mocked session
func (FakeSession) Close ¶
func (t FakeSession) Close()
Close does nothing because this is a fake session
func (FakeSession) DB ¶
func (t FakeSession) DB(name string) connection.DataLayer
DB returns a mocked DB
func (FakeSession) Info ¶ added in v1.1.0
func (t FakeSession) Info() *connection.Info
Info returns the session info
func (FakeSession) New ¶
func (t FakeSession) New(host, port string) (connection.Session, error)
New just returns itself because this is a fake session
type MockCollection ¶
MockCollection is a mockable connection.Collection
func (*MockCollection) FindAll ¶
func (c *MockCollection) FindAll(result interface{}) error
FindAll is mocked via setup
func (*MockCollection) PipeAll ¶
func (c *MockCollection) PipeAll(query, result interface{}) error
PipeAll is mocked via setup
type MockDatabase ¶
MockDatabase is a mockable connection.DataLayer
func (*MockDatabase) AssertExpectations ¶
func (db *MockDatabase) AssertExpectations(t mock.TestingT) bool
AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order.
func (*MockDatabase) C ¶
func (db *MockDatabase) C(name string) connection.Collection
C is a mocked via setup
func (*MockDatabase) CollectionNames ¶
func (db *MockDatabase) CollectionNames() ([]string, error)
CollectionNames is mocked via setup
func (*MockDatabase) MockCollection ¶
func (db *MockDatabase) MockCollection(name string, callCount int) *MockCollection
MockCollection returns, and adds if not present, a MockCollection
func (*MockDatabase) Run ¶
func (db *MockDatabase) Run(cmd interface{}, result interface{}) error
Run is mocked via setup
type MockSession ¶
MockSession is a mockable connection.Session
func (*MockSession) AssertExpectations ¶
func (s *MockSession) AssertExpectations(t mock.TestingT) bool
AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order.
func (*MockSession) DB ¶
func (s *MockSession) DB(name string) connection.DataLayer
DB is mocked via setup
func (*MockSession) Info ¶ added in v1.1.0
func (s *MockSession) Info() *connection.Info
Info returns the session info
func (*MockSession) MockDatabase ¶
func (s *MockSession) MockDatabase(name string, callCount int) *MockDatabase
MockDatabase returns, and adds if not present, a MockDatabase
func (*MockSession) New ¶
func (s *MockSession) New(host, port string) (connection.Session, error)
New is mocked via setup