testutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InfluxHost is the default InfluxDB host to be used in integration tests
	InfluxHost = "http://localhost:8086"
	// TsConnStringTemplate is the conn string for the default Timescale host to be used in integration tests
	TsConnStringTemplate = "user=postgres password=postgres port=5433 dbname=%s sslmode=disable"
)

Variables

This section is empty.

Functions

func ClearServersAfterITest

func ClearServersAfterITest(db string)

ClearServersAfterITest Deletes a database on both the default influx and timescale servers

func CreateInfluxDB

func CreateInfluxDB(db string) error

CreateInfluxDB creates a new influx database to the default influx server. Used for integration tests

func CreateInfluxMeasure

func CreateInfluxMeasure(db, measure string, tags []*map[string]string, values []*map[string]interface{}) error

CreateInfluxMeasure creates a measure with the specified name. For each point the tags and field values are given as maps

func CreateInfluxMeasureWithRP

func CreateInfluxMeasureWithRP(db, rp, measure string, tags []*map[string]string, values []*map[string]interface{}) error

CreateInfluxMeasureWithRP creates a measure with the specified name and specified RP. For each point the tags and field values are given as maps

func CreateInfluxRP

func CreateInfluxRP(db, rp string) error

CreateInfluxRP creates a retention policy with the specified name and 1 day duration as maps

func CreateNonAdminInTS

func CreateNonAdminInTS(user, pass string) error

CreateNonAdminInTS creates a user with login and password

func CreateTimescaleDb

func CreateTimescaleDb(db string) error

CreateTimescaleDb creates a new database on the default server and then creates the extension on it

func CreateTimescaleSchema

func CreateTimescaleSchema(db, schema string) error

CreateTimescaleSchema creates a new schema in the specified db

func DeleteInfluxDb

func DeleteInfluxDb(db string) error

DeleteInfluxDb deletes a influx database on the default influx server. Used for integration tests

func DeleteTimescaleDb

func DeleteTimescaleDb(db string) error

DeleteTimescaleDb drops a databass on the default server

func OpenTSConn

func OpenTSConn(db string) (*pgx.Conn, error)

OpenTSConn opens a connection to a TimescaleDB with the default (super admin) user/pass

func OpenTsConnWithUser

func OpenTsConnWithUser(db, user, pass string) (*pgx.Conn, error)

OpenTsConnWithUser opens a connection to a TimescaleDB with the supplied user and pass

func PrepareServersForITest

func PrepareServersForITest(db string) error

PrepareServersForITest Creates a database with the same name on the default influx server and default timescale server

Types

This section is empty.

Jump to

Keyboard shortcuts

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