mgotest

package module
v0.0.0-...-34c1160 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: BSD-3-Clause Imports: 13 Imported by: 6

README

Documentation

Overview

Package mgotest provides standalone test instances of mongo sutable for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fatalf

type Fatalf interface {
	Fatalf(format string, args ...interface{})
}

Fatalf is satisfied by testing.T or testing.B.

type ReplicaSet

type ReplicaSet struct {
	T       Fatalf
	Servers []*Server
}

ReplicaSet provides a configured ReplicaSet.

func NewReplicaSet

func NewReplicaSet(num uint, tb Fatalf) *ReplicaSet

NewReplicaSet makes a new ReplicaSet with the given number of nodes.

func (*ReplicaSet) Addrs

func (r *ReplicaSet) Addrs() []string

Addrs for all the servers.

func (*ReplicaSet) Session

func (r *ReplicaSet) Session() *mgo.Session

Session for the mongo ReplicaSet.

func (*ReplicaSet) Stop

func (r *ReplicaSet) Stop()

Stop the ReplicaSet.

type Server

type Server struct {
	Port        int
	DBPath      string
	ReplSet     bool
	StopTimeout time.Duration
	T           Fatalf
	// contains filtered or unexported fields
}

Server is a unique instance of a mongod.

func NewReplSetServer

func NewReplSetServer(t Fatalf, args ...string) *Server

NewReplSetServer creates a new server starts it with ReplSet enabled.

func NewStartedServer

func NewStartedServer(t Fatalf, args ...string) *Server

NewStartedServer creates a new server starts it.

func (*Server) Session

func (s *Server) Session() *mgo.Session

Session for the mongo server.

func (*Server) Start

func (s *Server) Start(args ...string)

Start the server, this will return once the server has been started.

func (*Server) Stop

func (s *Server) Stop()

Stop the server, this will also remove all data.

func (*Server) URL

func (s *Server) URL() string

URL for the mongo server, suitable for use with mgo.Dial.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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