MCPcopy Create free account
hub / github.com/conforma/cli / AddStepsTo

Function AddStepsTo

acceptance/registry/registry.go:326–349  ·  view source on GitHub ↗

AddStepsTo adds Gherkin steps to the godog ScenarioContext

(sc *godog.ScenarioContext)

Source from the content-addressed store, hash-verified

324
325// AddStepsTo adds Gherkin steps to the godog ScenarioContext
326func AddStepsTo(sc *godog.ScenarioContext) {
327 sc.Step(`^stub registry running$`, startStubRegistry)
328 sc.Step(`^registry image "([^"]*)" should contain a layer with$`, assertImageContent)
329
330 sc.After(func(ctx context.Context, finished *godog.Scenario, scenarioErr error) (context.Context, error) {
331 if testenv.Persisted(ctx) {
332 return ctx, nil
333 }
334
335 if !testenv.HasState[registryState](ctx) {
336 return ctx, nil
337 }
338
339 state := testenv.FetchState[registryState](ctx)
340 if state.Container != nil {
341 if err := state.Container.Terminate(ctx); err != nil {
342 logger, _ := log.LoggerFor(ctx)
343 logger.Warnf("failed to terminate registry container: %v", err)
344 }
345 }
346
347 return ctx, nil
348 })
349}

Callers 1

initializeScenarioFunction · 0.92

Calls 3

PersistedFunction · 0.92
LoggerForFunction · 0.92
WarnfMethod · 0.65

Tested by 1

initializeScenarioFunction · 0.74