MCPcopy
hub / github.com/IBM/sarama / testMain

Function testMain

functional_test.go:69–94  ·  view source on GitHub ↗
(m *testing.M)

Source from the content-addressed store, hash-verified

67}
68
69func testMain(m *testing.M) int {
70 ctx := context.Background()
71 var env testEnvironment
72
73 if os.Getenv("DEBUG") == "true" {
74 Logger = log.New(os.Stderr, "[DEBUG] ", log.Lmicroseconds|log.Ltime)
75 }
76
77 usingExisting, err := existingEnvironment(ctx, &env)
78 if err != nil {
79 panic(err)
80 }
81 if !usingExisting {
82 err := prepareDockerTestEnvironment(ctx, &env)
83 if err != nil {
84 _ = tearDownDockerTestEnvironment(ctx, &env)
85 panic(err)
86 }
87 defer tearDownDockerTestEnvironment(ctx, &env) // nolint:errcheck
88 }
89 if err := prepareTestTopics(ctx, &env); err != nil {
90 panic(err)
91 }
92 FunctionalTestEnv = &env
93 return m.Run()
94}
95
96// NewFunctionalTestConfig returns a config meant to be used by functional tests.
97func NewFunctionalTestConfig() *Config {

Callers 1

TestMainFunction · 0.85

Calls 5

existingEnvironmentFunction · 0.85
prepareTestTopicsFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected