-
Notifications
You must be signed in to change notification settings - Fork 60
tests: fix flaky_TestConnectionHandlerOpenUpdateClose #507
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?
tests: fix flaky_TestConnectionHandlerOpenUpdateClose #507
Conversation
1dd596b to
6f4180e
Compare
|
Changes are ready. Please look this. |
6f4180e to
a0bc666
Compare
pool/connection_pool_test.go
Outdated
| h := &testHandler{} | ||
| poolOpts := pool.Opts{ | ||
| CheckTimeout: 100 * time.Microsecond, | ||
| CheckTimeout: 100 * time.Millisecond, |
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.
Does the change required? Or is it enough to just increase the timeout for context?
pool/connection_pool_test.go
Outdated
| roles := []bool{false, true} | ||
|
|
||
| ctx, cancel := test_helpers.GetPoolConnectContext() | ||
| ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
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.
It would be better to increase the timeout here:
go-tarantool/test_helpers/pool_helper.go
Lines 306 to 308 in 6a24a64
| func GetPoolConnectContext() (context.Context, context.CancelFunc) { | |
| return context.WithTimeout(context.Background(), time.Second) | |
| } |
30 seconds seems too much, but 5 seems good.
4ce2ff8 to
cdc571e
Compare
|
The problem has not been solved yet. Most likely, the problem lies elsewhere, not in time. |
-Increased the waiting time to 7000 Microsecond. Closes #502
cdc571e to
44195e6
Compare
| require.Eventually(t, func() bool { | ||
| _, err := connPool.Do(tarantool.NewCall17Request("box.cfg"). | ||
| Args([]interface{}{map[string]bool{ | ||
| "read_only": true, | ||
| }}), | ||
| pool.RW).GetResponse() | ||
| return err == nil | ||
| }, 100000*time.Microsecond, 100*time.Microsecond, "failed to make ro") |
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.
The test steps:
- Set roles for instances with
SetClusterRohelper. - Connect to instances (instances already initialized and roles are set) with
ConnectWithOpts.
So if we could not found found a RW-instance here the following problems are possible.
- Instances are not started or unconfigured or have box.info.status != "running". If so, we have a problem in the
SetClusterRohelper. SetClusterRocan not switch instances into the target status. If so, we have a problem in theSetClusterRohelper.ConnectWithOptsdon't connect to the whole available cluster inside. If so, we have a problem in theConnectWithOptsimplementation.- An instance switches it status from rw->ro or shutting down between
SetClusterRoandConnectWithOpts. If so, we need to find a reason and to avoid it somehow.
In any case, the problem isn't with the test code. We need to check the assumptions above and fix the root problem instead of masking them with retries.
|
Okay, I'll take a look. At the moment, the test is not flaking, but unfortunately, the time reduction is insignificant. |
tests: fix flaky_TestConnectionHandlerOpenUpdateClose
Closes #502