Documentation ¶
Overview ¶
This package is a set of convenience helpers and structs to make integration testing easier
Index ¶
- Variables
- func MustReadAll(r io.Reader) []byte
- func NewRetentionPolicySpec(name string, rf int, duration time.Duration) *meta.RetentionPolicySpec
- func RemoteEnabled() bool
- type Config
- type LocalServer
- func (s *LocalServer) CheckDropDatabases(dbs []string) error
- func (s *LocalServer) Close()
- func (s *LocalServer) Closed() bool
- func (s *LocalServer) ContainDatabase(name string) bool
- func (s *LocalServer) CreateDatabase(db string) (*meta.DatabaseInfo, error)
- func (s *LocalServer) CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
- func (s *LocalServer) CreateDatabaseShardKey(db string, shardKey string) error
- func (s *LocalServer) CreateDatabaseTagArrayEnabledAndRp(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
- func (s *LocalServer) CreateMeasurement(mst string) error
- func (s *LocalServer) DropDatabase(db string) error
- func (s LocalServer) HTTPGet(url string) (results string, err error)
- func (s LocalServer) HTTPPost(url string, content []byte) (results string, err error)
- func (s LocalServer) MustQuery(query string) string
- func (s LocalServer) MustQueryWithParams(query string, values url.Values) string
- func (s LocalServer) MustWrite(db, rp, body string, params url.Values) string
- func (s *LocalServer) Open() error
- func (s LocalServer) Query(query string) (results string, err error)
- func (s LocalServer) QueryWithParams(query string, values url.Values) (results string, err error)
- func (s *LocalServer) Reset() error
- func (s *LocalServer) SetLogOutput(w io.Writer)
- func (c LocalServer) URL() string
- func (s LocalServer) Write(db, rp, body string, params url.Values) (results string, err error)
- type Query
- type RemoteServer
- func (s *RemoteServer) CheckDropDatabases(dbs []string) error
- func (s *RemoteServer) Close()
- func (s *RemoteServer) Closed() bool
- func (s *RemoteServer) ContainDatabase(name string) bool
- func (s *RemoteServer) CreateDatabase(db string) (*meta.DatabaseInfo, error)
- func (s *RemoteServer) CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
- func (s *RemoteServer) CreateDatabaseShardKey(db string, shardKey string) error
- func (s *RemoteServer) CreateDatabaseTagArrayEnabledAndRp(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
- func (s *RemoteServer) CreateMeasurement(mst string) error
- func (s *RemoteServer) DropDatabase(db string) error
- func (s RemoteServer) HTTPGet(url string) (results string, err error)
- func (s RemoteServer) HTTPPost(url string, content []byte) (results string, err error)
- func (s RemoteServer) MustQuery(query string) string
- func (s RemoteServer) MustQueryWithParams(query string, values url.Values) string
- func (s RemoteServer) MustWrite(db, rp, body string, params url.Values) string
- func (s *RemoteServer) Open() error
- func (s RemoteServer) Query(query string) (results string, err error)
- func (s RemoteServer) QueryWithParams(query string, values url.Values) (results string, err error)
- func (s *RemoteServer) Reset() error
- func (s *RemoteServer) SetLogOutput(w io.Writer)
- func (s *RemoteServer) URL() string
- func (s RemoteServer) Write(db, rp, body string, params url.Values) (results string, err error)
- type Response
- type Server
- type Test
- type Tests
- type Write
- type WriteError
- type Writes
Constants ¶
This section is empty.
Variables ¶
var FailCount int
var LosAngeles = mustParseLocation("America/Los_Angeles")
var SuccessCount int
Functions ¶
func NewRetentionPolicySpec ¶
form a correct retention policy given name, replication factor and duration
func RemoteEnabled ¶
func RemoteEnabled() bool
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a test wrapper around a run.Config. It also contains a root temp directory, making cleanup easier.
func NewConfig ¶
func NewConfig() *Config
NewConfig returns the default config with temporary paths.
func NewParseConfig ¶
NewConfig returns the default config with temporary paths.
func ParseConfig ¶
func (*Config) FromTomlFile ¶
FromTomlFile loads the config from a TOML file.
type LocalServer ¶
LocalServer is a Server that is running in-process and can be accessed directly
func (*LocalServer) CheckDropDatabases ¶
func (s *LocalServer) CheckDropDatabases(dbs []string) error
func (*LocalServer) Close ¶
func (s *LocalServer) Close()
Close shuts down the server and removes all temporary paths.
func (*LocalServer) Closed ¶
func (s *LocalServer) Closed() bool
func (*LocalServer) ContainDatabase ¶
func (s *LocalServer) ContainDatabase(name string) bool
func (*LocalServer) CreateDatabase ¶
func (s *LocalServer) CreateDatabase(db string) (*meta.DatabaseInfo, error)
func (*LocalServer) CreateDatabaseAndRetentionPolicy ¶
func (s *LocalServer) CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
CreateDatabaseAndRetentionPolicy will create the database and retention policy.
func (*LocalServer) CreateDatabaseShardKey ¶
func (s *LocalServer) CreateDatabaseShardKey(db string, shardKey string) error
func (*LocalServer) CreateDatabaseTagArrayEnabledAndRp ¶ added in v1.1.0
func (s *LocalServer) CreateDatabaseTagArrayEnabledAndRp(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
func (*LocalServer) CreateMeasurement ¶ added in v1.1.1
func (s *LocalServer) CreateMeasurement(mst string) error
func (*LocalServer) DropDatabase ¶
func (s *LocalServer) DropDatabase(db string) error
func (LocalServer) HTTPGet ¶
HTTPGet makes an HTTP GET request to the server and returns the response.
func (LocalServer) HTTPPost ¶
HTTPPost makes an HTTP POST request to the server and returns the response.
func (LocalServer) MustQuery ¶
MustQuery executes a query against the server and returns the results.
func (LocalServer) MustQueryWithParams ¶
MustQueryWithParams executes a query against the server and returns the results.
func (*LocalServer) Open ¶
func (s *LocalServer) Open() error
Open opens the server. If running this test on a 32-bit platform it reduces the size of series files so that they can all be addressable in the process.
func (LocalServer) QueryWithParams ¶
Query executes a query against the server and returns the results.
func (*LocalServer) Reset ¶
func (s *LocalServer) Reset() error
func (*LocalServer) SetLogOutput ¶
func (s *LocalServer) SetLogOutput(w io.Writer)
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
type RemoteServer ¶
type RemoteServer struct {
// contains filtered or unexported fields
}
RemoteServer is a Server that is accessed remotely via the HTTP API
func (*RemoteServer) CheckDropDatabases ¶
func (s *RemoteServer) CheckDropDatabases(dbs []string) error
func (*RemoteServer) Close ¶
func (s *RemoteServer) Close()
func (*RemoteServer) Closed ¶
func (s *RemoteServer) Closed() bool
func (*RemoteServer) ContainDatabase ¶
func (s *RemoteServer) ContainDatabase(name string) bool
func (*RemoteServer) CreateDatabase ¶
func (s *RemoteServer) CreateDatabase(db string) (*meta.DatabaseInfo, error)
func (*RemoteServer) CreateDatabaseAndRetentionPolicy ¶
func (s *RemoteServer) CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
func (*RemoteServer) CreateDatabaseShardKey ¶
func (s *RemoteServer) CreateDatabaseShardKey(db string, shardKey string) error
func (*RemoteServer) CreateDatabaseTagArrayEnabledAndRp ¶ added in v1.1.0
func (s *RemoteServer) CreateDatabaseTagArrayEnabledAndRp(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error
func (*RemoteServer) CreateMeasurement ¶ added in v1.1.1
func (s *RemoteServer) CreateMeasurement(mst string) error
func (*RemoteServer) DropDatabase ¶
func (s *RemoteServer) DropDatabase(db string) error
func (RemoteServer) HTTPGet ¶
HTTPGet makes an HTTP GET request to the server and returns the response.
func (RemoteServer) HTTPPost ¶
HTTPPost makes an HTTP POST request to the server and returns the response.
func (RemoteServer) MustQuery ¶
MustQuery executes a query against the server and returns the results.
func (RemoteServer) MustQueryWithParams ¶
MustQueryWithParams executes a query against the server and returns the results.
func (*RemoteServer) Open ¶
func (s *RemoteServer) Open() error
func (RemoteServer) QueryWithParams ¶
Query executes a query against the server and returns the results.
func (*RemoteServer) Reset ¶
func (s *RemoteServer) Reset() error
Reset attempts to remove all database state by dropping everything
func (*RemoteServer) SetLogOutput ¶
func (s *RemoteServer) SetLogOutput(w io.Writer)
func (*RemoteServer) URL ¶
func (s *RemoteServer) URL() string
type Response ¶
Response represents a list of statement results.
func (*Response) Error ¶
Error returns the first error from any statement. Returns nil if no errors occurred on any statements.
func (Response) MarshalJSON ¶
MarshalJSON encodes a Response struct into JSON.
func (*Response) UnmarshalJSON ¶
UnmarshalJSON decodes the data into the Response struct.
type Server ¶
type Server interface { URL() string Open() error SetLogOutput(w io.Writer) Close() Closed() bool CreateDatabase(db string) (*meta.DatabaseInfo, error) CreateDatabaseTagArrayEnabledAndRp(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error CreateDatabaseShardKey(db string, shardKey string) error CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error CreateMeasurement(mst string) error DropDatabase(db string) error Reset() error ContainDatabase(name string) bool Query(query string) (results string, err error) QueryWithParams(query string, values url.Values) (results string, err error) Write(db, rp, body string, params url.Values) (results string, err error) MustWrite(db, rp, body string, params url.Values) string CheckDropDatabases(dbs []string) error }
Server represents a test wrapper for run.Server.
func NewTSDBServer ¶
NewServer returns a new instance of Server.
func OpenDefaultServer ¶
OpenDefaultServer opens a test server with a default database & retention policy.
func OpenServerWithVersion ¶
OpenServerWithVersion opens a test server with a specific version.
type WriteError ¶
type WriteError struct {
// contains filtered or unexported fields
}
func (WriteError) Body ¶
func (wr WriteError) Body() string
func (WriteError) Error ¶
func (wr WriteError) Error() string
func (WriteError) StatusCode ¶
func (wr WriteError) StatusCode() int