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

Function existingEnvironment

functional_test.go:264–282  ·  view source on GitHub ↗
(ctx context.Context, env *testEnvironment)

Source from the content-addressed store, hash-verified

262}
263
264func existingEnvironment(ctx context.Context, env *testEnvironment) (bool, error) {
265 toxiproxyAddr, ok := os.LookupEnv("TOXIPROXY_ADDR")
266 if !ok {
267 return false, nil
268 }
269 toxiproxyURL, err := url.Parse(toxiproxyAddr)
270 if err != nil {
271 return false, fmt.Errorf("$TOXIPROXY_ADDR not parseable as url")
272 }
273 if err := setupToxiProxies(env, toxiproxyURL.String()); err != nil {
274 return false, fmt.Errorf("failed to setup toxiproxies: %w", err)
275 }
276
277 env.KafkaVersion, ok = os.LookupEnv("KAFKA_VERSION")
278 if !ok {
279 return false, fmt.Errorf("KAFKA_VERSION needs to be provided with TOXIPROXY_ADDR")
280 }
281 return true, nil
282}
283
284func tearDownDockerTestEnvironment(ctx context.Context, env *testEnvironment) error {
285 args := []string{"compose", "down", "--volumes"}

Callers 1

testMainFunction · 0.85

Calls 3

setupToxiProxiesFunction · 0.85
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected