Skip to content

Commit 2ea164b

Browse files
committed
MB-67857: Fix flakiness of menelaus_cbauth cbauth_sync_t
The test can race with setting up menelaus_cbauth_worker, because the setup doesn't wait for this to be set up. The other tests weren't impacted because they implicitly waited for this by waiting for the initial UpdateDB call to be made. To ensure that cbauth_sync_t, and any future tests, are not flaky, the setup function should wait for the initial notification. Change-Id: If8688e8d720196b49260fc2f2f65701d5e3eef77 Reviewed-on: https://review.couchbase.org/c/ns_server/+/232520 Reviewed-by: Steve Watanabe <[email protected]> Tested-by: Peter Searby <[email protected]> Well-Formed: Restriction Checker
1 parent 24825ad commit 2ea164b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/menelaus_cbauth.erl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ start_fake_json_rpc_connection(Label) ->
712712
gen_event:notify(json_rpc_events,
713713
{started, Label, [internal,
714714
{heartbeat, ?HEARTBEAT_TIME_S}],
715-
self()}).
715+
self()}),
716+
%% Wait for initial notify to be handled, to avoid racy tests
717+
meck:wait(1, menelaus_cbauth_worker, notify, ['_', '_'], ?LONG_TIMEOUT).
716718

717719
cbauth_init_t() ->
718720
%% UpdateDB gets called once almost immediately
@@ -772,9 +774,6 @@ cbauth_stats_t() ->
772774
[] = stats().
773775

774776
cbauth_many_notify_t() ->
775-
%% Wait for initial notify to be handled
776-
meck:wait(1, menelaus_cbauth_worker, notify, ['_', '_'],
777-
?LONG_TIMEOUT),
778777
meck:wait(1, json_rpc_connection, perform_call,
779778
['_', "AuthCacheSvc.UpdateDB", '_', '_'], ?LONG_TIMEOUT),
780779
%% Ensure that the next perform_call doesn't immediately return

0 commit comments

Comments
 (0)