Documentation ¶
Index ¶
- func GetLocalAuthority() (string, error)
- func JSONBytesEqual(t *testing.T, expected, actual []byte, msgAndArgs ...interface{})
- func ObjectsEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{})
- func RenewGet(url string) (*http.Response, error)
- type ClickHouseContainer
- type Container
- type ContainerWrapper
- type Integration
- type MySQLContainer
- type PostgresContainer
- type RandomGenerator
- type RedisContainer
- type UniqueIDIface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalAuthority ¶
GetLocalAuthority returns host:port of local server
func JSONBytesEqual ¶
JSONBytesEqual unmarshalls two jsons into objects and uses ObjectsEqual
func ObjectsEqual ¶
ObjectsEqual uses reflect.DeepEqual under the hood
Types ¶
type ClickHouseContainer ¶
type ClickHouseContainer struct { Container testcontainers.Container Context context.Context Port int Dsns []string Database string // contains filtered or unexported fields }
ClickHouseContainer is a ClickHouse testcontainer
func NewClickhouseContainer ¶
func NewClickhouseContainer(ctx context.Context) (*ClickHouseContainer, error)
NewClickhouseContainer creates new Clickhouse test container if CH_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment
func (*ClickHouseContainer) Close ¶
func (ch *ClickHouseContainer) Close() error
Close terminates underlying docker container
func (*ClickHouseContainer) CountRows ¶
func (ch *ClickHouseContainer) CountRows(table string) (int, error)
CountRows returns row count in DB table with name = table or error if occurred
func (*ClickHouseContainer) GetSortedRows ¶
func (ch *ClickHouseContainer) GetSortedRows(table, selectClause, whereClause, orderClause string) ([]map[string]interface{}, error)
type ContainerWrapper ¶
type ContainerWrapper struct {
Container Container
}
type Integration ¶
type Integration struct { Name string ReqUrn string ReqBodyPath string ExpectedJSONPath string XAuthToken string ExpectedHTTPCode int ExpectedErrMsg string ExpectedDeleteCookie bool }
Integration is a struct for running Integration tests
type MySQLContainer ¶
type MySQLContainer struct { Container testcontainers.Container Context context.Context Host string Port int Database string Username string Password string // contains filtered or unexported fields }
MySQLContainer is a MySQL testcontainer
func NewMySQLContainer ¶
func NewMySQLContainer(ctx context.Context) (*MySQLContainer, error)
NewMySQLContainer creates new MySQL test container if MYSQL_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment
func (*MySQLContainer) Close ¶
func (mc *MySQLContainer) Close() error
Close terminates underlying mysql docker container
func (*MySQLContainer) GetSortedRows ¶
func (mc *MySQLContainer) GetSortedRows(table, selectClause, whereClause, orderClause string) ([]map[string]interface{}, error)
GetSortedRows returns all selected row from table ordered according to orderClause or error if occurred
type PostgresContainer ¶
type PostgresContainer struct { Container testcontainers.Container Context context.Context Host string Port int Database string Schema string Username string Password string // contains filtered or unexported fields }
PostgresContainer is a Postgres testcontainer
func NewPostgresContainer ¶
func NewPostgresContainer(ctx context.Context) (*PostgresContainer, error)
NewPostgresContainer creates new Postgres test container if PG_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment
func (*PostgresContainer) Close ¶
func (pgc *PostgresContainer) Close() error
Close terminates underlying postgres docker container
func (*PostgresContainer) CountRows ¶
func (pgc *PostgresContainer) CountRows(table string) (int, error)
CountRows returns row count in DB table with name = table or error if occurred
func (*PostgresContainer) GetSortedRows ¶
func (pgc *PostgresContainer) GetSortedRows(table, selectClause, whereClause, orderClause string) ([]map[string]interface{}, error)
GetSortedRows returns all selected row from table ordered according to orderClause or error if occurred
type RandomGenerator ¶
type RandomGenerator struct {
// contains filtered or unexported fields
}
RandomGenerator is a random data generator it is suggested to use 1 RandomGenerator per 1 table
func NewRandomGenerator ¶
func NewRandomGenerator(uniqueID UniqueIDIface) *RandomGenerator
func (*RandomGenerator) GenerateData ¶
func (rg *RandomGenerator) GenerateData(columns int, rows int) ([]map[string]interface{}, error)
func (*RandomGenerator) GenerateDataWithUniqueIDs ¶
func (rg *RandomGenerator) GenerateDataWithUniqueIDs(columns int, rows int, uniqueCount int) ([]map[string]interface{}, error)
GenerateDataWithUniqueIDs returns array of objects with length=rows. The amount of objects with uniqueID = uniqueCount
type RedisContainer ¶
type RedisContainer struct { Container testcontainers.Container Context context.Context Host string Port int }
RedisContainer is a Redis testcontainer
func NewRedisContainer ¶
func NewRedisContainer(ctx context.Context) (*RedisContainer, error)
NewRedisContainer creates new Redis test container if REDIS_TEST_PORT is not defined. Otherwise uses redis at defined port. This logic is required for running test at CI environment
func (*RedisContainer) Close ¶
func (rc *RedisContainer) Close()
Close terminates underlying docker container
type UniqueIDIface ¶
UniqueIDIface is used for preventing cycle dependency