test

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGroupBy added in v1.3.0

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

func MustDo added in v0.9.0

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

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

func MustMarshalJSON added in v0.5.0

func MustMarshalJSON(v interface{}) []byte

MustMarshalJSON marshals v to JSON. Panic on error.

func MustNewHTTPRequest added in v0.5.0

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

MustNewHTTPRequest creates a new HTTP request. Panic on error.

func NewBufferLogger added in v0.9.0

func NewBufferLogger() *bufferLogger

NewBufferLogger returns a new instance of BufferLogger.

func OptAllowedOrigins added in v1.0.0

func OptAllowedOrigins(origins []string) server.CommandOption

func TestField_SetCacheSize added in v1.0.0

func TestField_SetCacheSize(t *testing.T)

Ensure field can set its cache

Types

type Cluster added in v1.0.0

type Cluster []*Command

Cluster represents a Pilosa cluster (multiple Command instances)

func MustNewCluster added in v1.0.0

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

MustNewCluster creates a new cluster

func MustRunCluster added in v1.0.0

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

MustRunCluster creates and starts a new cluster

func (Cluster) Close added in v1.0.0

func (c Cluster) Close() error

Stop stops a Cluster

func (Cluster) CreateField added in v1.2.0

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 added in v1.2.0

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

func (Cluster) Query added in v1.2.0

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 added in v1.0.0

func (c Cluster) Start() error

Start runs a Cluster

type Command added in v1.0.0

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

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

func MustRunCommand added in v1.0.0

func MustRunCommand() *Command

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

func NewCommandNode added in v1.0.0

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

NewCommandNode returns a new instance of Command with clustering enabled.

func (*Command) Client added in v1.0.0

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

Client returns a client to connect to the program.

func (*Command) Close added in v1.0.0

func (m *Command) Close() error

Close closes the program and removes the underlying data directory.

func (*Command) GossipAddress added in v1.0.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

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 added in v1.0.0

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

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

func (*Command) QueryProtobuf added in v1.3.0

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

func (*Command) RecalculateCaches added in v1.0.0

func (m *Command) RecalculateCaches() error

RecalculateCaches is deprecated. Use MustRecalculateCaches.

func (*Command) Reopen added in v1.0.0

func (m *Command) Reopen() error

Reopen closes the program and reopens it.

func (*Command) URL added in v1.0.0

func (m *Command) URL() string

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

type Field added in v1.0.0

type Field struct {
	*pilosa.Field
}

Field represents a test wrapper for pilosa.Field.

type Holder added in v0.5.0

type Holder struct {
	*pilosa.Holder
}

Holder is a test wrapper for pilosa.Holder.

func MustOpenHolder added in v0.5.0

func MustOpenHolder() *Holder

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

func NewHolder added in v0.5.0

func NewHolder() *Holder

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

func (*Holder) ClearBit added in v1.0.0

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

ClearBit clears a bit on the given field.

func (*Holder) Close added in v0.5.0

func (h *Holder) Close() error

Close closes the holder and removes all underlying data.

func (*Holder) MustCreateIndexIfNotExists added in v0.5.0

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

MustCreateIndexIfNotExists returns a given index. Panic on error.

func (*Holder) MustSetBits added in v1.0.0

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 added in v1.2.0

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 added in v0.5.0

func (h *Holder) Reopen() error

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

func (*Holder) Row added in v1.0.0

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

Row returns a Row for a given field.

func (*Holder) RowAttrStore added in v1.0.0

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

func (*Holder) RowTime added in v1.0.0

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

func (*Holder) SetBit added in v1.0.0

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

SetBit sets a bit on the given field.

func (*Holder) SetBitTime added in v1.1.0

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 added in v0.5.0

type Index struct {
	*pilosa.Index
}

Index represents a test wrapper for pilosa.Index.

func MustOpenIndex added in v0.5.0

func MustOpenIndex() *Index

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

func (*Index) Close added in v0.5.0

func (i *Index) Close() error

Close closes the index and removes the underlying data.

func (*Index) CreateField added in v1.0.0

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

CreateField creates a field with the given options.

func (*Index) CreateFieldIfNotExists added in v1.0.0

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 added in v0.5.0

func (i *Index) Reopen() error

Reopen closes the index and reopens it.

type ModHasher added in v0.5.0

type ModHasher struct{}

modHasher represents a simple, mod-based hashing.

func (*ModHasher) Hash added in v0.5.0

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

Jump to

Keyboard shortcuts

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