-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
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
fix: make disableEager not trigger the race detector #746
fix: make disableEager not trigger the race detector #746
Conversation
107833e
to
023aee7
Compare
@@ -533,6 +534,21 @@ func Test_Create_Non_PK_ID(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func Test_Create_Parallel(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, this test failed first with the data race: https://github.com/gobuffalo/pop/runs/7304729964?check_suite_focus=true#step:6:47
==================
WARNING: DATA RACE
Read at 0x00c000074ca0 by goroutine 103:
github.com/gobuffalo/pop/v6.(*Connection).Create()
/home/runner/work/pop/pop/executors.go:176 +0x90
github.com/gobuffalo/pop/v6.Test_Create_Parallel.func1.1()
/home/runner/work/pop/pop/executors_test.go:546 +0x147
testing.tRunner()
/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47
Previous write at 0x00c000074ca0 by goroutine 80:
github.com/gobuffalo/pop/v6.(*Connection).disableEager()
/home/runner/work/pop/pop/connection.go:244 +0xbc
github.com/gobuffalo/pop/v6.(*Connection).Create()
/home/runner/work/pop/pop/executors.go:178 +0xa1
github.com/gobuffalo/pop/v6.Test_Create_Parallel.func1.1()
/home/runner/work/pop/pop/executors_test.go:546 +0x147
testing.tRunner()
/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1439 +0x213
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.18.3/x64/src/testing/testing.go:1486 +0x47
ed5da98
to
adc17e5
Compare
OK the tests are still not working, I'll fix them tomorrow... |
adc17e5
to
1de2d66
Compare
@@ -13,7 +13,7 @@ services: | |||
ports: | |||
- "3306:3306" | |||
postgres: | |||
image: postgres:9.6 | |||
image: postgres:10.21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous test failure was related to some postgres bug. As 9.6
is not supported anymore, I bumped to a supported version.
1de2d66
to
58adbcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thank you for the extensive test suite!
I agree on bumping PostgreSQL to the least supported version, I don't think anyone will run the 9.x branch.
Also, in the CI we use PostgreSQL 14 so I think this change is acceptable.
After a bit of code search I figured that the race detection mentioned in #723 is kind of a false positive. Adding this check ensures the race detector is not triggered.