Skip to content

Commit 90f66d5

Browse files
committed
MB-67857: ns_node_disco should depend on ns_node_disco_events
The order of dependency of these two processes in mock_helpers was the wrong way round. This can cause a race in the initialisation of ns_node_disco, causing flaky tests. Change-Id: I1e1fc51f764bacc1182fe471ca5f11f5b9461c9c Reviewed-on: https://review.couchbase.org/c/ns_server/+/232524 Well-Formed: Build Bot <[email protected]> Well-Formed: Restriction Checker Tested-by: Peter Searby <[email protected]> Reviewed-by: Steve Watanabe <[email protected]>
1 parent 2ea164b commit 90f66d5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/menelaus_cbauth.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ setup_t() ->
669669
fake_chronicle_kv:setup(),
670670
%% Test setups return a map of pids for later shutdown in the teardown
671671
PidMap = mock_helpers:setup_mocks([json_rpc_events,
672-
ns_node_disco_events,
672+
ns_node_disco,
673673
user_storage_events,
674674
ssl_service_events,
675675
json_rpc_connection_sup,

test/mock_helpers.erl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,14 @@ compat_mode_events(PidMap) ->
151151
PidMap#{?FUNCTION_NAME => CompatModeEventsPid}.
152152

153153
ns_node_disco(PidMap) ->
154-
setup_mocks([dist_manager], PidMap),
154+
PidMap0 = setup_mocks([dist_manager, ns_node_disco_events], PidMap),
155155
{ok, NsNodeDiscoPid} = ns_node_disco:start_link(),
156-
PidMap#{?FUNCTION_NAME => NsNodeDiscoPid}.
156+
PidMap0#{?FUNCTION_NAME => NsNodeDiscoPid}.
157157

158158
ns_node_disco_events(PidMap) ->
159-
PidMap0 = setup_mocks([ns_node_disco], PidMap),
160159
{ok, NSNodeDiscoEventsPid} = gen_event:start_link({local,
161160
?FUNCTION_NAME}),
162-
PidMap0#{?FUNCTION_NAME => NSNodeDiscoEventsPid}.
161+
PidMap#{?FUNCTION_NAME => NSNodeDiscoEventsPid}.
163162

164163
json_rpc_events(PidMap) ->
165164
{ok, JsonRpcEventsPid} = gen_event:start_link({local, ?FUNCTION_NAME}),

0 commit comments

Comments
 (0)