mgotest: github.com/facebookgo/mgotest Index | Files | Directories

package mgotest

import "github.com/facebookgo/mgotest"

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

Index

Package Files

mgotest.go rs.go

type Fatalf Uses

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

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

type ReplicaSet Uses

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

ReplicaSet provides a configured ReplicaSet.

func NewReplicaSet Uses

func NewReplicaSet(num uint, tb Fatalf) *ReplicaSet

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

func (*ReplicaSet) Addrs Uses

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

Addrs for all the servers.

func (*ReplicaSet) Session Uses

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

Session for the mongo ReplicaSet.

func (*ReplicaSet) Stop Uses

func (r *ReplicaSet) Stop()

Stop the ReplicaSet.

type Server Uses

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 Uses

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

NewReplSetServer creates a new server starts it with ReplSet enabled.

func NewStartedServer Uses

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

NewStartedServer creates a new server starts it.

func (*Server) Session Uses

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

Session for the mongo server.

func (*Server) Start Uses

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

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

func (*Server) Stop Uses

func (s *Server) Stop()

Stop the server, this will also remove all data.

func (*Server) URL Uses

func (s *Server) URL() string

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

Directories

PathSynopsis
mgotestrs

Package mgotest imports 13 packages (graph) and is imported by 5 packages. Updated 2017-04-03. Refresh now. Tools for package owners.