Skip to content

Commit 5b87c4f

Browse files
committed
Merge remote-tracking branch 'couchbase/phoenix' into morpheus
* couchbase/phoenix: MB-67857: Ensure cbauth_many_notify_t actually works Change-Id: I7eb59a0e800cef4e22ee5ad698886ada25af4d66
2 parents e08098b + 525ff7a commit 5b87c4f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

apps/ns_server/src/menelaus_cbauth.erl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,13 +799,13 @@ cbauth_many_notify_t() ->
799799
meck:wait(N, menelaus_cbauth_worker, notify, ['_', '_'],
800800
?LONG_TIMEOUT)
801801
end, [2, 3, 4]),
802+
Parent = self(),
802803
%% Extract value from next update
803804
meck:expect(json_rpc_connection, perform_call,
804805
fun (_, "AuthCacheSvc.UpdateDB", {Info}, _) ->
805806
[{Node}] = proplists:get_value(nodes, Info, []),
806-
[undefined, Port] = proplists:get_value(ports, Node),
807-
%% Expect the last value, not the stale value
808-
?assertEqual(4, Port),
807+
[Port] = proplists:get_value(ports, Node),
808+
Parent ! {port_sent, Port},
809809
{ok, true};
810810
(_Label, _Call, _EJsonArg, _Opts) ->
811811
{ok, true}
@@ -815,7 +815,14 @@ cbauth_many_notify_t() ->
815815
WorkerPid ! return_from_call,
816816
%% Wait for both the stuck and final call to return
817817
meck:wait(3, json_rpc_connection, perform_call,
818-
['_', "AuthCacheSvc.UpdateDB", '_', '_'], ?LONG_TIMEOUT).
818+
['_', "AuthCacheSvc.UpdateDB", '_', '_'], ?LONG_TIMEOUT),
819+
receive
820+
{port_sent, Port} ->
821+
%% Expect the last value, not the stale value
822+
?assertEqual(4, Port)
823+
after ?LONG_TIMEOUT ->
824+
error(timeout)
825+
end.
819826

820827
trigger_notification(ns_node_disco_events) ->
821828
%% To avoid needing to trick ns_node_disco into recognising fake nodes, just

0 commit comments

Comments
 (0)