Documentation
¶
Index ¶
- func RunIntegrationTest(t interface{ ... }, testFunc func(redisAddr, kafkaAddr string))
- func SkipIfDependenciesUnavailable(t *testing.T, redisAddr, kafkaAddr string)
- func SkipIfKafkaUnavailable(t *testing.T, kafkaAddr string)
- func SkipIfRedisUnavailable(t *testing.T, redisAddr string)
- func WithDependencies(t interface{ ... }, depType DependencyType, testFunc interface{})
- func WithKafkaOnly(t interface{ ... }, testFunc func(kafkaAddr string))
- func WithRedisOnly(t interface{ ... }, testFunc func(redisAddr string))
- func WithTestDependencies(t interface{ ... }, testFunc func(redisAddr, kafkaAddr string))
- type DependencyType
- type DockerContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunIntegrationTest ¶
func RunIntegrationTest(t interface {
Helper()
Skip(args ...interface{})
Cleanup(f func())
Errorf(format string, args ...interface{})
Logf(format string, args ...interface{})
}, testFunc func(redisAddr, kafkaAddr string))
RunIntegrationTest runs an integration test with both Redis and Kafka containers, configuring them for the matchingo integration testing. This is specifically designed for integration tests that need to verify the end-to-end functionality.
func SkipIfDependenciesUnavailable ¶
SkipIfDependenciesUnavailable skips the test if either Redis or Kafka is unavailable
func SkipIfKafkaUnavailable ¶
SkipIfKafkaUnavailable skips the test if Kafka is unavailable on the specified address
func SkipIfRedisUnavailable ¶
SkipIfRedisUnavailable skips the test if Redis is unavailable on the specified address
func WithDependencies ¶
func WithDependencies(t interface {
Helper()
Skip(args ...interface{})
Cleanup(f func())
Errorf(format string, args ...interface{})
}, depType DependencyType, testFunc interface{})
WithDependencies runs a test with the specified dependencies. It automatically sets up and tears down the required containers.
func WithKafkaOnly ¶
func WithKafkaOnly(t interface {
Helper()
Skip(args ...interface{})
Cleanup(f func())
Errorf(format string, args ...interface{})
}, testFunc func(kafkaAddr string))
WithKafkaOnly runs a test function with only Kafka dependency It starts the Kafka container, runs the test, then stops the container regardless of the test outcome
func WithRedisOnly ¶
func WithRedisOnly(t interface {
Helper()
Skip(args ...interface{})
Cleanup(f func())
Errorf(format string, args ...interface{})
}, testFunc func(redisAddr string))
WithRedisOnly runs a test function with only Redis dependency It starts the Redis container, runs the test, then stops the container regardless of the test outcome
func WithTestDependencies ¶
func WithTestDependencies(t interface {
Helper()
Skip(args ...interface{})
Cleanup(f func())
Errorf(format string, args ...interface{})
}, testFunc func(redisAddr, kafkaAddr string))
WithTestDependencies runs a test function with Redis and Kafka dependencies It starts the containers, runs the test, then stops the containers regardless of test outcome
Types ¶
type DependencyType ¶
type DependencyType int
DependencyType specifies which dependencies are needed for a test
const ( // NoDependencies indicates that no external dependencies are needed NoDependencies DependencyType = iota // RedisOnly indicates that only Redis is needed RedisOnly // KafkaOnly indicates that only Kafka is needed KafkaOnly // RedisAndKafka indicates that both Redis and Kafka are needed RedisAndKafka )
type DockerContainer ¶
type DockerContainer struct {
ID string
Name string
Type string
Port string
HostPort string
StartedAt time.Time
}
DockerContainer represents a Docker container used for testing
func StartKafkaContainer ¶
func StartKafkaContainer(ctx context.Context) (*DockerContainer, error)
StartKafkaContainer starts a Kafka container for testing
func StartRedisContainer ¶
func StartRedisContainer(ctx context.Context) (*DockerContainer, error)
StartRedisContainer starts a Redis container for testing