package tests
import "github.com/influxdata/influxdb/tests"
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, futureWriteLimit time.Duration, pastWriteLimit time.Duration) *meta.RetentionPolicySpec
- func RemoteEnabled() bool
- type Config
- type LocalServer
- func (s *LocalServer) Close()
- func (s *LocalServer) Closed() 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) CreateSubscription(database, rp, name, mode string, destinations []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) TcpAddr() string
- func (s *LocalServer) URL() string
- func (s LocalServer) Write(db, rp, body string, params url.Values) (results string, err error)
- func (s *LocalServer) WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, user meta.User, points []models.Point) error
- type Query
- type Server
- func NewServer(c *Config) Server
- func OpenDefaultServer(c *Config) Server
- func OpenServer(c *Config) Server
- func OpenServerWithVersion(c *Config, version string) Server
- type Test
- type Tests
- type Write
- type WriteError
- func (wr WriteError) Body() string
- func (wr WriteError) Error() string
- func (wr WriteError) StatusCode() int
- type Writes
Variables ¶
var LosAngeles = mustParseLocation("America/Los_Angeles")
Functions ¶
func MustReadAll ¶
MustReadAll reads r. Panic on error.
func NewRetentionPolicySpec ¶
func NewRetentionPolicySpec(name string, rf int, duration time.Duration, futureWriteLimit time.Duration, pastWriteLimit time.Duration) *meta.RetentionPolicySpec
form a correct retention policy given name, replication factor and duration
func RemoteEnabled ¶
func RemoteEnabled() bool
Types ¶
type Config ¶
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.
type LocalServer ¶
LocalServer is a Server that is running in-process and can be accessed directly
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) 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) CreateSubscription ¶
func (s *LocalServer) CreateSubscription(database, rp, name, mode string, destinations []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) MustWrite ¶
MustWrite executes a write to the server. Panic on error.
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) Query ¶
Query executes a query against the server and returns the results.
func (LocalServer) QueryWithParams ¶
Query executes a query against the server and returns the results.
func (*LocalServer) Reset ¶
func (s *LocalServer) Reset() error
func (*LocalServer) TcpAddr ¶
func (s *LocalServer) TcpAddr() string
func (*LocalServer) URL ¶
func (s *LocalServer) URL() string
URL returns the base URL for the httpd endpoint.
func (LocalServer) Write ¶
Write executes a write against the server and returns the results.
func (*LocalServer) WritePoints ¶
func (s *LocalServer) WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, user meta.User, points []models.Point) error
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) Error ¶
func (*Query) Execute ¶
Execute runs the command and returns an err if it fails
type Server ¶
type Server interface { URL() string TcpAddr() string Open() error SetLogOutput(w io.Writer) Close() Closed() bool CreateDatabase(db string) (*meta.DatabaseInfo, error) CreateDatabaseAndRetentionPolicy(db string, rp *meta.RetentionPolicySpec, makeDefault bool) error CreateSubscription(database, rp, name, mode string, destinations []string) error DropDatabase(db string) error Reset() error 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 WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, user meta.User, points []models.Point) error }
Server represents a test wrapper for run.Server.
func NewServer ¶
NewServer returns a new instance of Server.
func OpenDefaultServer ¶
OpenDefaultServer opens a test server with a default database & retention policy.
func OpenServer ¶
OpenServer opens a test server.
func OpenServerWithVersion ¶
OpenServerWithVersion opens a test server with a specific version.
type Test ¶
type Test struct {
// contains filtered or unexported fields
}
func NewTest ¶
type Tests ¶
type Write ¶
type Write struct {
// contains filtered or unexported fields
}
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
type Writes ¶
type Writes []*Write
Source Files ¶
server_helpers.go server_suite.go
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 19 packages
- Last checked
- 2 days ago –
Tools for package owners.