Skip to content

Conversation

@babyTsakhes
Copy link
Collaborator

@babyTsakhes babyTsakhes commented Dec 1, 2025

tests: fix flaky_TestConnectionHandlerOpenUpdateClose

  • Increased the waiting time to milliseconds.
  • Changed the require.Nilf on require.NoError.

Closes #502

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-502-flaky_TestConnectionHandlerOpenUpdateClose branch from 1dd596b to 6f4180e Compare December 9, 2025 14:35
@babyTsakhes babyTsakhes marked this pull request as ready for review December 9, 2025 14:38
@babyTsakhes
Copy link
Collaborator Author

Changes are ready. Please look this.

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-502-flaky_TestConnectionHandlerOpenUpdateClose branch from 6f4180e to a0bc666 Compare December 15, 2025 19:25
h := &testHandler{}
poolOpts := pool.Opts{
CheckTimeout: 100 * time.Microsecond,
CheckTimeout: 100 * time.Millisecond,
Copy link
Collaborator

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?

roles := []bool{false, true}

ctx, cancel := test_helpers.GetPoolConnectContext()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
Copy link
Collaborator

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:

func GetPoolConnectContext() (context.Context, context.CancelFunc) {
return context.WithTimeout(context.Background(), time.Second)
}

30 seconds seems too much, but 5 seems good.

@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-502-flaky_TestConnectionHandlerOpenUpdateClose branch 2 times, most recently from 4ce2ff8 to cdc571e Compare January 9, 2026 17:29
@babyTsakhes
Copy link
Collaborator Author

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
@babyTsakhes babyTsakhes force-pushed the babyTsakhes/gh-502-flaky_TestConnectionHandlerOpenUpdateClose branch from cdc571e to 44195e6 Compare January 11, 2026 19:08
Comment on lines +1135 to +1142
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")
Copy link
Collaborator

@oleg-jukovec oleg-jukovec Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test steps:

  1. Set roles for instances with SetClusterRo helper.
  2. 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.

  1. Instances are not started or unconfigured or have box.info.status != "running". If so, we have a problem in the SetClusterRo helper.
  2. SetClusterRo can not switch instances into the target status. If so, we have a problem in the SetClusterRo helper.
  3. ConnectWithOpts don't connect to the whole available cluster inside. If so, we have a problem in the ConnectWithOpts implementation.
  4. An instance switches it status from rw->ro or shutting down between SetClusterRo and ConnectWithOpts. 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.

@babyTsakhes
Copy link
Collaborator Author

Okay, I'll take a look. At the moment, the test is not flaking, but unfortunately, the time reduction is insignificant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: flaky TestConnectionHandlerOpenUpdateClose

3 participants