Back to godoc.org
github.com/pilosa/pilosa/test

package test

v1.4.0
Latest Go to latest
Published: Sep 17, 2019 | License: Apache-2.0 | Module: github.com/pilosa/pilosa

Index

func CheckGroupBy

func CheckGroupBy(t *testing.T, expected, results []pilosa.GroupCount)

func MustDo

func MustDo(method, urlStr string, body string) *httpResponse

MustDo executes http.Do() with an http.NewRequest(). Panic on error.

func MustMarshalJSON

func MustMarshalJSON(v interface{}) []byte

MustMarshalJSON marshals v to JSON. Panic on error.

func MustNewHTTPRequest

func MustNewHTTPRequest(method, urlStr string, body io.Reader) *gohttp.Request

MustNewHTTPRequest creates a new HTTP request. Panic on error.

func NewBufferLogger

func NewBufferLogger() *bufferLogger

NewBufferLogger returns a new instance of BufferLogger.

func OptAllowedOrigins

func OptAllowedOrigins(origins []string) server.CommandOption

func TestField_SetCacheSize

func TestField_SetCacheSize(t *testing.T)

Ensure field can set its cache

type Cluster

type Cluster []*Command

Cluster represents a Pilosa cluster (multiple Command instances)

func MustNewCluster

func MustNewCluster(tb testing.TB, size int, opts ...[]server.CommandOption) Cluster

MustNewCluster creates a new cluster

func MustRunCluster

func MustRunCluster(tb testing.TB, size int, opts ...[]server.CommandOption) Cluster

MustRunCluster creates and starts a new cluster

func (Cluster) Close

func (c Cluster) Close() error

Stop stops a Cluster

func (Cluster) CreateField

func (c Cluster) CreateField(t testing.TB, index string, iopts pilosa.IndexOptions, field string, fopts ...pilosa.FieldOption) *pilosa.Field

CreateField creates the index (if necessary) and field specified.

func (Cluster) ImportBits

func (c Cluster) ImportBits(t testing.TB, index, field string, rowcols [][2]uint64)

func (Cluster) Query

func (c Cluster) Query(t testing.TB, index, query string) pilosa.QueryResponse

Query executes an API.Query through one of the cluster's node's API. It fails the test if there is an error.

func (Cluster) Start

func (c Cluster) Start() error

Start runs a Cluster

type Command

type Command struct {
	*server.Command
	// contains filtered or unexported fields
}

////////////////////////////////////////////////////////////////////////////////// Command represents a test wrapper for server.Command.

func MustRunCommand

func MustRunCommand() *Command

MustRunCommand returns a new, running Main. Panic on error.

func NewCommandNode

func NewCommandNode(isCoordinator bool, opts ...server.CommandOption) *Command

NewCommandNode returns a new instance of Command with clustering enabled.

func (*Command) Client

func (m *Command) Client() *http.InternalClient

Client returns a client to connect to the program.

func (*Command) Close

func (m *Command) Close() error

Close closes the program and removes the underlying data directory.

func (*Command) GossipAddress

func (m *Command) GossipAddress() string

GossipAddress returns the address on which gossip is listening after a Main has been setup. Useful to pass as a seed to other nodes when creating and testing clusters.

func (*Command) MustCreateField

func (m *Command) MustCreateField(tb testing.TB, index, field string, opts ...pilosa.FieldOption) *pilosa.Field

MustCreateField uses this command's API to create the field. The index must already exist - it fails the test if there is an error.

func (*Command) MustCreateIndex

func (m *Command) MustCreateIndex(tb testing.TB, name string, opts pilosa.IndexOptions) *pilosa.Index

MustCreateIndex uses this command's API to create an index and fails the test if there is an error.

func (*Command) MustQuery

func (m *Command) MustQuery(tb testing.TB, req *pilosa.QueryRequest) pilosa.QueryResponse

MustQuery uses this command's API to execute the given query request, failing if Query returns a non-nil error, otherwise returning the QueryResponse.

func (*Command) MustRecalculateCaches

func (m *Command) MustRecalculateCaches(tb testing.TB)

MustRecalculateCaches calls RecalculateCaches on the command's API, and fails if there is an error.

func (*Command) Query

func (m *Command) Query(index, rawQuery, query string) (string, error)

Query executes a query against the program through the HTTP API.

func (*Command) QueryProtobuf

func (m *Command) QueryProtobuf(indexName string, query string) (*pilosa.QueryResponse, error)

func (*Command) RecalculateCaches

func (m *Command) RecalculateCaches() error

RecalculateCaches is deprecated. Use MustRecalculateCaches.

func (*Command) Reopen

func (m *Command) Reopen() error

Reopen closes the program and reopens it.

func (*Command) URL

func (m *Command) URL() string

URL returns the base URL string for accessing the running program.

type Field

type Field struct {
	*pilosa.Field
}

Field represents a test wrapper for pilosa.Field.

type Holder

type Holder struct {
	*pilosa.Holder
}

Holder is a test wrapper for pilosa.Holder.

func MustOpenHolder

func MustOpenHolder() *Holder

MustOpenHolder creates and opens a holder at a temporary path. Panic on error.

func NewHolder

func NewHolder() *Holder

NewHolder returns a new instance of Holder with a temporary path.

func (*Holder) ClearBit

func (h *Holder) ClearBit(index, field string, rowID, columnID uint64)

ClearBit clears a bit on the given field.

func (*Holder) Close

func (h *Holder) Close() error

Close closes the holder and removes all underlying data.

func (*Holder) MustCreateIndexIfNotExists

func (h *Holder) MustCreateIndexIfNotExists(index string, opt pilosa.IndexOptions) *Index

MustCreateIndexIfNotExists returns a given index. Panic on error.

func (*Holder) MustSetBits

func (h *Holder) MustSetBits(index, field string, rowID uint64, columnIDs ...uint64)

MustSetBits sets columns on a row. Panic on error. This function does not accept a timestamp or quantum.

func (*Holder) ReadRow

func (h *Holder) ReadRow(index, field string, rowID uint64) *pilosa.Row

ReadRow returns a Row for a given field. If the field does not exist, it panics rather than creating the field.

func (*Holder) Reopen

func (h *Holder) Reopen() error

Reopen instantiates and opens a new holder. Note that the holder must be Closed first.

func (*Holder) Row

func (h *Holder) Row(index, field string, rowID uint64) *pilosa.Row

Row returns a Row for a given field.

func (*Holder) RowAttrStore

func (h *Holder) RowAttrStore(index, field string) pilosa.AttrStore

func (*Holder) RowTime

func (h *Holder) RowTime(index, field string, rowID uint64, t time.Time, quantum string) *pilosa.Row

func (*Holder) SetBit

func (h *Holder) SetBit(index, field string, rowID, columnID uint64)

SetBit sets a bit on the given field.

func (*Holder) SetBitTime

func (h *Holder) SetBitTime(index, field string, rowID, columnID uint64, t *time.Time)

SetBitTime sets a bit with timestamp on the given field.

type Index

type Index struct {
	*pilosa.Index
}

Index represents a test wrapper for pilosa.Index.

func MustOpenIndex

func MustOpenIndex() *Index

MustOpenIndex returns a new, opened index at a temporary path. Panic on error.

func (*Index) Close

func (i *Index) Close() error

Close closes the index and removes the underlying data.

func (*Index) CreateField

func (i *Index) CreateField(name string, opts ...pilosa.FieldOption) (*Field, error)

CreateField creates a field with the given options.

func (*Index) CreateFieldIfNotExists

func (i *Index) CreateFieldIfNotExists(name string, opts ...pilosa.FieldOption) (*Field, error)

CreateFieldIfNotExists creates a field with the given options if it doesn't exist.

func (*Index) Reopen

func (i *Index) Reopen() error

Reopen closes the index and reopens it.

type ModHasher

type ModHasher struct{}

modHasher represents a simple, mod-based hashing.

func (*ModHasher) Hash

func (*ModHasher) Hash(key uint64, n int) int
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier