Skip to content

Commit

Permalink
Better feature test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
EinKrebs committed Apr 2, 2024
1 parent 8440d31 commit c026c1e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/feature/spqr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func (tctx *testContext) stepErrorShouldMatch(host string, matcher string, body
}

// nolint: unused
func InitializeScenario(s *godog.ScenarioContext, t *testing.T) {
func InitializeScenario(s *godog.ScenarioContext, t *testing.T, debug bool) {
tctx, err := newTestContext(t)
if err != nil {
// TODO: how to report errors in godog
Expand All @@ -785,6 +785,9 @@ func InitializeScenario(s *godog.ScenarioContext, t *testing.T) {
})
s.StepContext().After(func(ctx context.Context, step *godog.Step, status godog.StepResultStatus, err error) (context.Context, error) {
if err != nil {
if !debug {
return ctx, err
}
log.Println(err)
log.Println("sleeping")
time.Sleep(time.Hour)
Expand Down Expand Up @@ -865,9 +868,14 @@ func TestSpqr(t *testing.T) {
paths = append(paths, featureDir)
}

debug := false
if debugEnv, ok := os.LookupEnv("FEATURE_DEBUG"); ok && strings.ToLower(debugEnv) == "true" {
debug = true
}

suite := godog.TestSuite{
ScenarioInitializer: func(s *godog.ScenarioContext) {
InitializeScenario(s, t)
InitializeScenario(s, t, debug)
},
Options: &godog.Options{
Format: "pretty",
Expand Down

0 comments on commit c026c1e

Please sign in to comment.