-
Notifications
You must be signed in to change notification settings - Fork 1.7k
suite: add SyncTest #1834
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
base: master
Are you sure you want to change the base?
suite: add SyncTest #1834
Conversation
|
@brackendawson, can take a look please? |
|
Hey, thanks for adding this! |
|
I created a issue about support of synctest in suite. Even do your change is nice, probably alot of people will use it wrong. You can't reuse channels inside the bubble, if they are created outside the bubble (e.g. if they are part of the suite). |
It's a fair point that we need to think of an API that makes sense for how people normally use suites. Let me think about it. |
| } | ||
|
|
||
| func TestSyncTest(t *testing.T) { | ||
| t.Setenv("GODEBUG", "asynctimerchan=0") // since our go.mod says `go 1.17` |
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.
BTW, Not sure if it's worth referencing the specific release notes https://go.dev/doc/go1.23#timer-changes
|
As an alternative experiment, I locally forked the entire |
Note that a suite only for synctest shall not provide Update: I also did a fast draft and added direct synctest support into the suite by prefixing synctests with Probably the solution is a new suite that runs each test inside a bubble and does not allow to have |
|
Forking
The first 3 methods can be moved into a common struct. |
I tried to create a new Maybe i am dumb and it can work. I don't have experience with build flags so far. I will try out more today. Update: Here is a branch where i added |
|
Did you try two mutually exclusive files, one for go1.25 and one for !go1.25? |
Introduces
(*Suite).SyncTestwhich is tosynctest.Runlike(*Suite).Runis to(*testing.T).Run.Its role is to maintain
s.T()(so it points to synctest bubble'st).synctest was introduced in go 1.25, so this is built conditionally.