Skip to content

Commit 525ff7a

Browse files
committed
Merge remote-tracking branch 'couchbase/trinity' into phoenix
* couchbase/trinity: MB-67857: Ensure cbauth_many_notify_t actually works Change-Id: I5102d1ebdc0962e3a49184b0b5d9247e4788148d
2 parents b32ecc4 + 26efdb8 commit 525ff7a

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)