pilosa: github.com/pilosa/pilosa/test Index | Files

package test

import "github.com/pilosa/pilosa/test"

Index

Package Files

cluster.go field.go handler.go holder.go index.go logger.go pilosa.go

func CheckGroupBy Uses

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

func MustDo Uses

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

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

func MustMarshalJSON Uses

func MustMarshalJSON(v interface{}) []byte

MustMarshalJSON marshals v to JSON. Panic on error.

func MustNewHTTPRequest Uses

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

MustNewHTTPRequest creates a new HTTP request. Panic on error.

func NewBufferLogger Uses

func NewBufferLogger() *bufferLogger

NewBufferLogger returns a new instance of BufferLogger.

func OptAllowedOrigins Uses

func OptAllowedOrigins(origins []string) server.CommandOption

func RetryUntil Uses

func RetryUntil(timeout time.Duration, fn func() error) (err error)

RetryUntil repeatedly executes fn until it returns nil or timeout occurs.

func TestField_SetCacheSize Uses

func TestField_SetCacheSize(t *testing.T)

Ensure field can set its cache

type Cluster Uses

type Cluster []*Command

Cluster represents a Pilosa cluster (multiple Command instances)

func MustNewCluster Uses

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

MustNewCluster creates a new cluster

func MustRunCluster Uses

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

MustRunCluster creates and starts a new cluster

func (Cluster) Close Uses

func (c Cluster) Close() error

Stop stops a Cluster

func (Cluster) CreateField Uses

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 Uses

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

func (Cluster) Query Uses

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 Uses

func (c Cluster) Start() error

Start runs a Cluster

type Command Uses

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

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

func MustRunCommand Uses

func MustRunCommand() *Command

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

func NewCommandNode Uses

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

NewCommandNode returns a new instance of Command with clustering enabled.

func (*Command) Client Uses

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

Client returns a client to connect to the program.

func (*Command) Close Uses

func (m *Command) Close() error

Close closes the program and removes the underlying data directory.

func (*Command) GossipAddress Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

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

func (*Command) QueryProtobuf Uses

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

func (*Command) RecalculateCaches Uses

func (m *Command) RecalculateCaches() error

RecalculateCaches is deprecated. Use MustRecalculateCaches.

func (*Command) Reopen Uses

func (m *Command) Reopen() error

Reopen closes the program and reopens it.

func (*Command) URL Uses

func (m *Command) URL() string

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

type Field Uses

type Field struct {
    *pilosa.Field
}

Field represents a test wrapper for pilosa.Field.

type Holder Uses

type Holder struct {
    *pilosa.Holder
}

Holder is a test wrapper for pilosa.Holder.

func MustOpenHolder Uses

func MustOpenHolder() *Holder

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

func NewHolder Uses

func NewHolder() *Holder

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

func (*Holder) ClearBit Uses

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

ClearBit clears a bit on the given field.

func (*Holder) Close Uses

func (h *Holder) Close() error

Close closes the holder and removes all underlying data.

func (*Holder) MustCreateIndexIfNotExists Uses

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

MustCreateIndexIfNotExists returns a given index. Panic on error.

func (*Holder) MustSetBits Uses

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 Uses

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 Uses

func (h *Holder) Reopen() error

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

func (*Holder) Row Uses

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

Row returns a Row for a given field.

func (*Holder) RowAttrStore Uses

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

func (*Holder) RowTime Uses

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

func (*Holder) SetBit Uses

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

SetBit sets a bit on the given field.

func (*Holder) SetBitTime Uses

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 Uses

type Index struct {
    *pilosa.Index
}

Index represents a test wrapper for pilosa.Index.

func MustOpenIndex Uses

func MustOpenIndex() *Index

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

func (*Index) Close Uses

func (i *Index) Close() error

Close closes the index and removes the underlying data.

func (*Index) CreateField Uses

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

CreateField creates a field with the given options.

func (*Index) CreateFieldIfNotExists Uses

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 Uses

func (i *Index) Reopen() error

Reopen closes the index and reopens it.

type ModHasher Uses

type ModHasher struct{}

modHasher represents a simple, mod-based hashing.

func (*ModHasher) Hash Uses

func (*ModHasher) Hash(key uint64, n int) int

Package test imports 20 packages (graph). Updated 2019-10-18. Refresh now. Tools for package owners.