We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Описание бага Написал простой пример асинхронных тестов, запустил с флагом --race и наткнулся на гонки
--race
Код
package service_test import ( "context" "testing" "github.com/ozontech/allure-go/pkg/framework/provider" "github.com/ozontech/allure-go/pkg/framework/suite" ) type SetupSuite struct { suite.Suite } func (s *SetupSuite) Test_Auth_RegisterEmployee(t provider.T) { t.Title("[Auth] RegisterEmployee") t.Descriptionf("Register employee tests") t.Tags("auth") t.Parallel() t.WithNewAsyncStep("Incorrect company ID", func(sCtx provider.StepCtx) { ctx := context.TODO() sCtx.WithNewParameters("ctx", ctx) }) t.WithNewAsyncStep("Correct request", func(sCtx provider.StepCtx) { ctx := context.TODO() sCtx.WithNewParameters("ctx", ctx) }) } func TestRunner(t *testing.T) { suite.RunSuite(t, new(SetupSuite)) }
Запуск через консоль
go test ./internal/service/auth_test.go --race
Вывод
================== WARNING: DATA RACE Read at 0x00c0001b6d90 by goroutine 11: github.com/ozontech/allure-go/pkg/framework/core/allure_manager/ctx.(*testCtx).AddStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/ctx/test_ctx.go:19 +0x50 github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager.(*allureManager).Step() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/manager/steps.go:9 +0x4c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewStep.deferwrap1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:15 +0x54 runtime.deferreturn() /opt/homebrew/opt/go/libexec/src/runtime/panic.go:605 +0x5c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:36 +0xc4 Previous write at 0x00c0001b6d90 by goroutine 12: github.com/ozontech/allure-go/pkg/framework/core/allure_manager/ctx.(*testCtx).AddStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/ctx/test_ctx.go:19 +0x108 github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager.(*allureManager).Step() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/manager/steps.go:9 +0x4c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewStep.deferwrap1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:15 +0x54 runtime.deferreturn() /opt/homebrew/opt/go/libexec/src/runtime/panic.go:605 +0x5c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:36 +0xc4 Goroutine 11 (running) created at: github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:34 +0x174 command-line-arguments_test.(*SetupSuite).Test_Auth_RegisterEmployee() /Users/stepa/Study/Testing/internal/service/auth_test.go:21 +0x154 runtime.call32() /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:505 +0x74 reflect.Value.Call() /opt/homebrew/opt/go/libexec/src/reflect/value.go:365 +0x90 github.com/ozontech/allure-go/pkg/framework/runner.(*testMethod).GetBody.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/tests.go:155 +0x280 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:206 +0x408 testing.tRunner() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1743 +0x40 Goroutine 12 (finished) created at: github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:34 +0x174 command-line-arguments_test.(*SetupSuite).Test_Auth_RegisterEmployee() /Users/stepa/Study/Testing/internal/service/auth_test.go:25 +0x188 runtime.call32() /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:505 +0x74 reflect.Value.Call() /opt/homebrew/opt/go/libexec/src/reflect/value.go:365 +0x90 github.com/ozontech/allure-go/pkg/framework/runner.(*testMethod).GetBody.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/tests.go:155 +0x280 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:206 +0x408 testing.tRunner() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1743 +0x40 ================== ================== WARNING: DATA RACE Read at 0x00c000054280 by goroutine 11: runtime.growslice() /opt/homebrew/opt/go/libexec/src/runtime/slice.go:177 +0x0 github.com/ozontech/allure-go/pkg/framework/core/allure_manager/ctx.(*testCtx).AddStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/ctx/test_ctx.go:19 +0x88 github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager.(*allureManager).Step() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/manager/steps.go:9 +0x4c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewStep.deferwrap1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:15 +0x54 runtime.deferreturn() /opt/homebrew/opt/go/libexec/src/runtime/panic.go:605 +0x5c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:36 +0xc4 Previous write at 0x00c000054280 by goroutine 12: github.com/ozontech/allure-go/pkg/framework/core/allure_manager/ctx.(*testCtx).AddStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/ctx/test_ctx.go:19 +0xac github.com/ozontech/allure-go/pkg/framework/core/allure_manager/manager.(*allureManager).Step() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/allure_manager/manager/steps.go:9 +0x4c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewStep.deferwrap1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:15 +0x54 runtime.deferreturn() /opt/homebrew/opt/go/libexec/src/runtime/panic.go:605 +0x5c github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:36 +0xc4 Goroutine 11 (running) created at: github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:34 +0x174 command-line-arguments_test.(*SetupSuite).Test_Auth_RegisterEmployee() /Users/stepa/Study/Testing/internal/service/auth_test.go:21 +0x154 runtime.call32() /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:505 +0x74 reflect.Value.Call() /opt/homebrew/opt/go/libexec/src/reflect/value.go:365 +0x90 github.com/ozontech/allure-go/pkg/framework/runner.(*testMethod).GetBody.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/tests.go:155 +0x280 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:206 +0x408 testing.tRunner() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1743 +0x40 Goroutine 12 (finished) created at: github.com/ozontech/allure-go/pkg/framework/core/common.(*Common).WithNewAsyncStep() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/core/common/steps.go:34 +0x174 command-line-arguments_test.(*SetupSuite).Test_Auth_RegisterEmployee() /Users/stepa/Study/Testing/internal/service/auth_test.go:25 +0x188 runtime.call32() /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:505 +0x74 reflect.Value.Call() /opt/homebrew/opt/go/libexec/src/reflect/value.go:365 +0x90 github.com/ozontech/allure-go/pkg/framework/runner.(*testMethod).GetBody.func1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/tests.go:155 +0x280 github.com/ozontech/allure-go/pkg/framework/runner.(*runner).RunTests.func1.3.1() /Users/stepa/go/pkg/mod/github.com/ozontech/allure-go/pkg/[email protected]/runner/runner.go:206 +0x408 testing.tRunner() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1690 +0x184 testing.(*T).Run.gowrap1() /opt/homebrew/opt/go/libexec/src/testing/testing.go:1743 +0x40 ================== --- FAIL: TestRunner (0.00s) --- FAIL: TestRunner/SetupSuite (0.00s) --- FAIL: TestRunner/SetupSuite/Tests (0.00s) --- FAIL: TestRunner/SetupSuite/Tests/Test_Auth_RegisterEmployee (0.00s) testing.go:1399: race detected during execution of test FAIL FAIL command-line-arguments 0.353s FAIL
Характеристики
MacOS
go version go1.23.1 darwin/arm64
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Описание бага
Написал простой пример асинхронных тестов, запустил с флагом
--race
и наткнулся на гонкиКод
Запуск через консоль
go test ./internal/service/auth_test.go --race
Вывод
Характеристики
MacOS
go version go1.23.1 darwin/arm64
The text was updated successfully, but these errors were encountered: