Documentation ¶
Index ¶
- Constants
- func ExpectGCPMessagesInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, ...) error
- func GetIntegrationTestTimeout() time.Duration
- 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 ReadGCPMessagesInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, ...) ([][]byte, 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[T any](first, second []T) bool
- type GCPPubSubIntegrationTestParams
- type GCPPubSubIntegrationTester
- func (g *GCPPubSubIntegrationTester) ContainerStart(ctx context.Context) (*abstractedcontainers.GCPPubSubContainer, error)
- func (g *GCPPubSubIntegrationTester) ContainsWantedMessages(ctx context.Context, expectedData [][]byte) error
- func (g *GCPPubSubIntegrationTester) ContainsWantedMessagesInDuration(ctx context.Context, expectedData [][]byte, timeToTimeout time.Duration) error
- func (g *GCPPubSubIntegrationTester) CreateClient(ctx context.Context) (*pubsub.Client, error)
- func (g *GCPPubSubIntegrationTester) PublishData(ctx context.Context, wantedData []byte) error
- func (g *GCPPubSubIntegrationTester) ReadMessages(ctx context.Context) ([][]byte, error)
- func (g *GCPPubSubIntegrationTester) ReadMessagesInDuration(ctx context.Context, timeToTimeout time.Duration) ([][]byte, error)
- type HttpHeaderValuePair
- type HttpIntegrationTestSituation
- type HttpIntegrationTestSituationExpectation
- type HttpIntegrationTestSituationRequest
- type HttpIntegrationTestSituationResult
- 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
- type Sakerhet
- type SakerhetBuilder
Constants ¶
View Source
const ( SakerhetRunIntegrationTestsEnvVar = "SAKERHET_RUN_INTEGRATION_TESTS" SakerhetIntegrationTestsTimeoutSeconds = "SAKERHET_INTEGRATION_TEST_TIMEOUT" )
Variables ¶
This section is empty.
Functions ¶
func ExpectGCPMessagesInSub ¶ added in v0.0.9
func ExpectGCPMessagesInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, expectedData [][]byte, timeToWait time.Duration) error
Receive messages for a given duration, which simplifies testing.
func GetIntegrationTestTimeout ¶ added in v0.0.3
func GetOrCreateGCPTopic ¶
func InitPostgreSQLSchema ¶
func PublishToGCPTopic ¶
func ReadGCPMessagesInSub ¶ added in v0.0.9
func ReadGCPMessagesInSub(ctx context.Context, client *pubsub.Client, subscriptionID string, timeToWait time.Duration) ([][]byte, error)
Receive messages for a given duration, which simplifies testing.
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 (g *GCPPubSubIntegrationTester) ContainsWantedMessages(ctx context.Context, expectedData [][]byte) error
func (*GCPPubSubIntegrationTester) ContainsWantedMessagesInDuration ¶ added in v0.0.3
func (*GCPPubSubIntegrationTester) CreateClient ¶
func (*GCPPubSubIntegrationTester) PublishData ¶
func (g *GCPPubSubIntegrationTester) PublishData(ctx context.Context, wantedData []byte) error
func (*GCPPubSubIntegrationTester) ReadMessages ¶ added in v0.0.9
func (g *GCPPubSubIntegrationTester) ReadMessages(ctx context.Context) ([][]byte, error)
func (*GCPPubSubIntegrationTester) ReadMessagesInDuration ¶ added in v0.0.9
type HttpHeaderValuePair ¶ added in v0.0.3
type HttpIntegrationTestSituation ¶ added in v0.0.3
type HttpIntegrationTestSituation struct { Request *HttpIntegrationTestSituationRequest Expectation *HttpIntegrationTestSituationExpectation Timeout time.Duration }
func (HttpIntegrationTestSituation) SituationChecker ¶ added in v0.0.3
func (s HttpIntegrationTestSituation) SituationChecker() (*HttpIntegrationTestSituationResult, error)
type HttpIntegrationTestSituationExpectation ¶ added in v0.0.3
type HttpIntegrationTestSituationRequest ¶ added in v0.0.3
type HttpIntegrationTestSituationRequest struct { RequestURL string RequestMethod string RequestHeaders []HttpHeaderValuePair RequestBody []byte }
type HttpIntegrationTestSituationResult ¶ added in v0.0.11
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 ¶
type Sakerhet ¶ added in v0.1.0
type Sakerhet struct { GCPPubSubIntegrationTester *GCPPubSubIntegrationTester PostgreSQLIntegrationTester *PostgreSQLIntegrationTester }
func NewSakerhetIntegrationTest ¶ added in v0.1.0
func NewSakerhetIntegrationTest(sakerhetBuilder SakerhetBuilder) Sakerhet
Sakerhet Integration test smart constructor
type SakerhetBuilder ¶ added in v0.1.0
type SakerhetBuilder struct { GCPPubSub *GCPPubSubIntegrationTestParams PostgreSQL *PostgreSQLIntegrationTestParams }
Click to show internal directories.
Click to hide internal directories.