test

package
v2.5.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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) C

func (d FakeDB) C(name string) connection.Collection

C returns a fake collection

func (FakeDB) CollectionNames

func (d FakeDB) CollectionNames() ([]string, error)

CollectionNames returns a mocked array of collection names

func (FakeDB) Run

func (d FakeDB) Run(cmd interface{}, result interface{}) error

Run runs a command on a fake DB

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

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

type MockCollection struct {
	mock.Mock
}

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

type MockDatabase struct {
	mock.Mock
	// contains filtered or unexported fields
}

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

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

type MockSession struct {
	mock.Mock
	// contains filtered or unexported fields
}

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) Close

func (s *MockSession) Close()

Close is mocked via setup

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL