Skip to content

fix: stabilize flaky integration tests - #140

Merged
nickkkccc merged 2 commits into
masterfrom
northarea/vshard-storages-ready-probe
Oct 29, 2026
Merged

nickkkccc merged 2 commits into
masterfrom
northarea/vshard-storages-ready-probe

Conversation

@NorthArea

@NorthArea NorthArea commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes two integration tests that failed in CI.

  1. fix(testcontainers): await vshard master handshake — VshardClusterContainer was reported ready while a replicaset master was still in the vshard handshake: the 1.7.0 probe iterated rs.replicas, which vshard.router.info() does not return. The first async crud.truncate then failed with VHANDSHAKE_NOT_COMPLETE (CI of fix: handle failed connection attempts once #139, tests-crud-integration (3.5.0)). The probe now makes a synchronous callrw to every master (it reopens a connection that vshard closed after a failed handshake and waits for the new one) and requires every master to be available.
  2. test(client): accept checks error message without function name — testSelectWrongParameters fails on every fresh build since checks 287c88e dropped the to nil suffix; the test cluster does not pin checks.

Known flaky tests not fixed here:

  • ConnectionToTarantoolTest.testSendAndReceiveWithConcurrentClose (tests-box-integration) — a race in ConnectionImpl.send()/close(), fixed in fix: handle failed connection attempts once #139.
  • CartridgeClusterContainer.setupTopology on 2.11.8 (tests-crud-integration) — cartridge replicasets setup cause unknown.

Чинит два интеграционных теста, падавших в CI.

  1. Проба vshard — контейнер объявлялся готовым, пока ведущий ещё проходил рукопожатие (проба 1.7.0 перебирала rs.replicas, которого нет в vshard.router.info()); первый crud.truncate падал с VHANDSHAKE_NOT_COMPLETE. Теперь синхронный callrw к каждому ведущему и все ведущие available.
  2. checks — testSelectWrongParameters падает на каждой свежей сборке после 287c88e в checks (убран хвост to nil), версия checks не закреплена.

Известные нестабильные тесты, которые здесь не чинятся:

  • testSendAndReceiveWithConcurrentClose (box) — гонка send()/close() в ядре, исправлена в fix: handle failed connection attempts once #139.
  • CartridgeClusterContainer.setupTopology на 2.11.8 (crud) — причина пока неизвестна.

I haven't forgotten about:

  • Tests — test infrastructure change; verified on a stand and by this PR's CI
  • Changelog
  • Documentation
  • JavaDoc was written
  • Commit messages comply with the guideline
  • Cleanup the code for review. See checklist

See also #139

NorthArea pushed a commit that referenced this pull request Oct 29, 2026
Drop the statement semicolons from the Lua readiness probe and read
the state string with result.get(1): the probe always returns the pair
(ready, state). Review comments on #140.
@NorthArea NorthArea changed the title fix(testcontainers): check master status in vshard readiness probe fix: stabilize flaky integration tests Oct 29, 2026
Aleksandr Iuskasov added 2 commits October 29, 2026 16:16
The readiness probe added in 1.7.0 iterated `rs.replicas`, a field that
`vshard.router.info()` does not return (vshard 0.1.25 reports `master`
and `replica` per replicaset). The loop never ran, so the container was
reported ready while a replicaset master was still in the vshard
handshake, and the first `crud.truncate` in spring-data integration
tests failed with VHANDSHAKE_NOT_COMPLETE (CI of #139).

Checking the master status alone is not enough. On a stand the router
state stayed `storage-002 master=unreachable replica=available` for
120 s: the router connected to storage-002-a before its storage was
configured, the vshard handshake failed with "storage is not
configured", and vshard closed the connection
(vshard/replicaset.lua conn_vconnect_check_or_close). Only a request to
that master reopens it; discovery and failover talk to the replica. The
first asynchronous crud map call reopens it but does not wait for the
new handshake. Requiring zero unknown buckets does not work either: the
router may not know part of the buckets for a while after the masters
are ready.

Make a synchronous `callrw('vshard.storage.buckets_count')` to the
master of every replicaset: it reopens a closed connection and waits for
the handshake. Require all calls to succeed and every master to be
`available`, and log call errors, replica and bucket states.
checks 287c88e ("exclude nil function name from error messages",
2026-10-28) drops the " to nil" suffix from "unexpected argument"
errors. crud 1.5.0 depends on `checks >= 3.1.0-1`, so the test cluster
picks it up on every fresh build, and testSelectWrongParameters fails
on master with "... select.lua:320: unexpected argument opts.coolOption".

Accept the message with and without the suffix.
@NorthArea
NorthArea force-pushed the northarea/vshard-storages-ready-probe branch 2 times, most recently from bb7ca71 to 3bc1f6f Compare October 29, 2026 11:33
@nickkkccc
nickkkccc merged commit ff401bf into master Oct 29, 2026
6 checks passed
@nickkkccc
nickkkccc deleted the northarea/vshard-storages-ready-probe branch October 29, 2026 12:41
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.

3 participants