(m *testing.M)
| 67 | } |
| 68 | |
| 69 | func 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. |
| 97 | func NewFunctionalTestConfig() *Config { |
no test coverage detected