Closed xpoft closed 1 year ago
Describe the bug
WithNewAsyncStep in WithNewAsyncStep will cause deadlock and tests will never finish.
WithNewAsyncStep in step won't be executed async
To Reproduce
package my_suite
import ( "github.com/ozontech/allure-go/pkg/framework/provider" )
func (s *Suite) TestSome3(t provider.T) { t.Parallel()
t.WithNewStep("sync-step1", func(sCtx provider.StepCtx) { sCtx.WithNewAsyncStep("sync-step1-async-step-1", func(sCtx provider.StepCtx) { sCtx.WithNewAsyncStep("sync-step1-async-step-1-step1", func(sCtx provider.StepCtx) { }) }) })
}
2.
import ( "time"
"github.com/ozontech/allure-go/pkg/framework/provider"
)
startedAt := time.Now() timeSinceStart := func() int64 { return int64(time.Since(startedAt).Round(time.Second).Seconds()) } sleepDuration := 5 * time.Second t.WithNewStep("sync-step1", func(sCtx provider.StepCtx) { sCtx.Logf("sync-step1. start: %d", timeSinceStart()) time.Sleep(sleepDuration) sCtx.Logf("sync-step1. finish: %d", timeSinceStart()) sCtx.WithNewAsyncStep("sync-step1-async-step-1", func(sCtx provider.StepCtx) { sCtx.Logf("sync-step1-async-step-1. start: %d", timeSinceStart()) time.Sleep(sleepDuration) sCtx.Logf("sync-step1-async-step-1. finish: %d", timeSinceStart()) }) sCtx.WithNewAsyncStep("sync-step1-async-step-2", func(sCtx provider.StepCtx) { sCtx.Logf("sync-step1-async-step-2. start: %d", timeSinceStart()) time.Sleep(sleepDuration) sCtx.Logf("sync-step1-async-step-2. finish: %d", timeSinceStart()) }) }) t.WithNewStep("sync-step2", func(sCtx provider.StepCtx) { sCtx.Logf("sync-step2. start: %d", timeSinceStart()) time.Sleep(sleepDuration) sCtx.Logf("sync-step2. finish: %d", timeSinceStart()) })
output
step_context.go:104: sync-step1. finish: 5 step_context.go:104: sync-step1-async-step-1. start: 5 step_context.go:104: sync-step1-async-step-1. finish: 10 step_context.go:104: sync-step1-async-step-2. start: 10 step_context.go:104: sync-step1-async-step-2. finish: 15 step_context.go:104: sync-step2. start: 15 step_context.go:104: sync-step2. finish: 20
**Expected behavior** 1. No deadlock 2. Async steps
Describe the bug
WithNewAsyncStep in WithNewAsyncStep will cause deadlock and tests will never finish.
WithNewAsyncStep in step won't be executed async
To Reproduce
import ( "github.com/ozontech/allure-go/pkg/framework/provider" )
func (s *Suite) TestSome3(t provider.T) { t.Parallel()
}
package my_suite
import ( "time"
)
func (s *Suite) TestSome3(t provider.T) { t.Parallel()
}