-
Notifications
You must be signed in to change notification settings - Fork 10
/
kafka_suite_test.go
40 lines (31 loc) · 1.02 KB
/
kafka_suite_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package kafka_wrapper_test
import (
"github.com/Trendyol/kafka-wrapper/internal/testcontainers/kafka"
"github.com/stretchr/testify/suite"
"log"
"testing"
)
type testKafkaSuite struct {
suite.Suite
Wrapper kafka.TestContainerWrapper
RemoteWrapper kafka.TestContainerWrapper
}
func TestKafka(t *testing.T) {
suite.Run(t, new(testKafkaSuite))
}
func (s *testKafkaSuite) SetupSuite() {
log.Println("Starting local container")
if err := s.Wrapper.RunContainer("9092"); err != nil {
log.Fatalf("Error occurred while running local container, err: %+v", err)
}
log.Println("Starting remote container")
if err := s.RemoteWrapper.RunContainer("9093"); err != nil {
log.Fatalf("Error occurred while running remote container, err: %+v", err)
}
log.Printf("Local Container is running on address: %s", s.Wrapper.GetBrokerAddress())
log.Printf("Remote Container is running on address: %s", s.RemoteWrapper.GetBrokerAddress())
}
func (s *testKafkaSuite) TearDownSuite() {
s.Wrapper.CleanUp()
s.RemoteWrapper.CleanUp()
}