Documentation
¶
Index ¶
- Constants
- func AwaitGCPMessageInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, ...) error
- func GetOrCreateGCPTopic(ctx context.Context, client *pubsub.Client, topicID string) (*pubsub.Topic, error)
- func InitPostgreSQLSchema(ctx context.Context, db *pgxpool.Pool, schema []string) error
- func PublishToGCPTopic(ctx context.Context, client *pubsub.Client, topic *pubsub.Topic, ...) error
- func SeedPostgreSQLData(ctx context.Context, db *pgxpool.Pool, query string, data [][]any) error
- func SkipIntegrationTestsWhenUnitTesting(t *testing.T)
- func SkipUnitTestsWhenIntegrationTesting(t *testing.T)
- func TruncatePostgreSQLTable(ctx context.Context, db *pgxpool.Pool, tables []string) error
- func UnorderedEqual(first, second []any) bool
- func UnorderedEqualByteArrays(first, second [][]byte) bool
- type GCPPubSubIntegrationTestParams
- type GCPPubSubIntegrationTester
- func (g *GCPPubSubIntegrationTester) ContainerStart(ctx context.Context) (*abstractedcontainers.GCPPubSubContainer, error)
- func (g *GCPPubSubIntegrationTester) ContainsWantedMessages(ctx context.Context, timeToTimeout time.Duration, expectedData [][]byte) error
- func (g *GCPPubSubIntegrationTester) CreateClient(ctx context.Context) (*pubsub.Client, error)
- func (g *GCPPubSubIntegrationTester) PublishData(ctx context.Context, wantedData []byte) error
- type IntegrationTester
- type IntegrationTesterParams
- type PostgreSQLIntegrationTestExpectation
- type PostgreSQLIntegrationTestParams
- type PostgreSQLIntegrationTestSeed
- type PostgreSQLIntegrationTestSituation
- type PostgreSQLIntegrationTester
- func (p *PostgreSQLIntegrationTester) CheckContainsExpectedData(resultSet []any, expected []any) error
- func (g *PostgreSQLIntegrationTester) ContainerStart(ctx context.Context) (*abstractedcontainers.PostgreSQLContainer, error)
- func (p *PostgreSQLIntegrationTester) FetchData(ctx context.Context, dbPool *pgxpool.Pool, query string, ...) ([]any, error)
- func (p *PostgreSQLIntegrationTester) InitSchema(ctx context.Context, dbPool *pgxpool.Pool, initialSchema []string) error
- func (p *PostgreSQLIntegrationTester) SeedData(ctx context.Context, dbPool *pgxpool.Pool, ...) error
- func (p *PostgreSQLIntegrationTester) TruncateTable(ctx context.Context, dbPool *pgxpool.Pool, tables []string) error
Constants ¶
View Source
const (
SakerhetRunIntegrationTestsEnvVar = "SAKERHET_RUN_INTEGRATION_TESTS"
)
Variables ¶
This section is empty.
Functions ¶
func AwaitGCPMessageInSub ¶
func AwaitGCPMessageInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, expectedData [][]byte, timeToWait time.Duration) error
Receive messages for a given duration, which simplifies testing.
func GetOrCreateGCPTopic ¶
func InitPostgreSQLSchema ¶
func PublishToGCPTopic ¶
func SeedPostgreSQLData ¶
func TruncatePostgreSQLTable ¶
func UnorderedEqual ¶
Types ¶
type GCPPubSubIntegrationTester ¶
type GCPPubSubIntegrationTester struct {
ProjectID string
TopicID string
SubscriptionID string
PubSubURI string
}
func NewGCPPubSubIntegrationTester ¶
func NewGCPPubSubIntegrationTester(g *GCPPubSubIntegrationTestParams) *GCPPubSubIntegrationTester
func (*GCPPubSubIntegrationTester) ContainerStart ¶
func (g *GCPPubSubIntegrationTester) ContainerStart(ctx context.Context) (*abstractedcontainers.GCPPubSubContainer, error)
func (*GCPPubSubIntegrationTester) ContainsWantedMessages ¶
func (*GCPPubSubIntegrationTester) CreateClient ¶
func (*GCPPubSubIntegrationTester) PublishData ¶
func (g *GCPPubSubIntegrationTester) PublishData(ctx context.Context, wantedData []byte) error
type IntegrationTester ¶
type IntegrationTester struct {
GCPPubSubIntegrationTester *GCPPubSubIntegrationTester
PostgreSQLIntegrationTester *PostgreSQLIntegrationTester
}
func NewIntegrationTest ¶
func NewIntegrationTest(userInput IntegrationTesterParams) IntegrationTester
type IntegrationTesterParams ¶
type IntegrationTesterParams struct {
GCPPubSub *GCPPubSubIntegrationTestParams
PostgreSQL *PostgreSQLIntegrationTestParams
}
type PostgreSQLIntegrationTestSituation ¶
type PostgreSQLIntegrationTestSituation struct {
Seeds []PostgreSQLIntegrationTestSeed
Expects []PostgreSQLIntegrationTestExpectation
}
type PostgreSQLIntegrationTester ¶
func NewPostgreSQLIntegrationTester ¶
func NewPostgreSQLIntegrationTester(p *PostgreSQLIntegrationTestParams) *PostgreSQLIntegrationTester
func (*PostgreSQLIntegrationTester) CheckContainsExpectedData ¶
func (p *PostgreSQLIntegrationTester) CheckContainsExpectedData(resultSet []any, expected []any) error
func (*PostgreSQLIntegrationTester) ContainerStart ¶
func (g *PostgreSQLIntegrationTester) ContainerStart(ctx context.Context) (*abstractedcontainers.PostgreSQLContainer, error)
func (*PostgreSQLIntegrationTester) InitSchema ¶
func (*PostgreSQLIntegrationTester) SeedData ¶
func (p *PostgreSQLIntegrationTester) SeedData(ctx context.Context, dbPool *pgxpool.Pool, seeds []PostgreSQLIntegrationTestSeed) error
func (*PostgreSQLIntegrationTester) TruncateTable ¶
Click to show internal directories.
Click to hide internal directories.