-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unavailableNodes list having joined nodes #45
Conversation
Ping result with pang could arrive after nodeup
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 98.25% 98.26% +0.01%
==========================================
Files 10 10
Lines 745 750 +5
==========================================
+ Hits 732 737 +5
Misses 13 13 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. I think that node state could be simplified later because of too many lists in the status - one list with node status for each node instead.
888c199
to
ee5db7e
Compare
test/cets_SUITE.erl
Outdated
Cond = fun() -> lists:member(Node, nodes()) end, | ||
cets_test_wait:wait_until(Cond, true), | ||
Me ! send_ping_result_called, | ||
%% Similate pang returned to cets_discovery. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simulate? Simulated? I can't understand this sentence.
test/cets_SUITE.erl
Outdated
meck:passthrough([Pid, Node, pang]) | ||
end), | ||
try | ||
Setup = setup_two_nodes_and_discovery(Config, [wait]), | ||
%% setup_two_nodes_and_discovery would call disconnect_node node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"disconnect_node node"? Can't understand it either. Is it a typo or did you mean a particular node?
test/cets_SUITE.erl
Outdated
?assertMatch([Node1, Node2], maps:get(joined_nodes, Status)), | ||
%% Ensure that send_ping_result was called | ||
%% (it is not called if node is in the nodes() list) | ||
receive_message(send_ping_result_called) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doesn't make sense to check it after the testcase, because it might have arrived after we checked unavailable nodes. I would move it before all the ?assertMatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes some sense, because here is how the function looks like:
ping_not_connected_nodes(Nodes) ->
Self = self(),
NotConNodes = Nodes -- [node() | nodes()],
[
spawn_link(fun() -> cets_ping:send_ping_result(Self, Node, cets_ping:ping(Node)) end)
|| Node <- lists:sort(NotConNodes)
],
ok.
So there is a chance that node got connected by the reason not related to the current test - in this case cets_ping:send_ping_result/2
would never be called :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few more comments... I really think this case got overly verbose and it's hard to understand some of the comments. I would leave only the ones that are most important, i.e. the ones that explain when the node is up, and that we send pang
afterwards.
test/cets_SUITE.erl
Outdated
?assertMatch([], maps:get(unavailable_nodes, Status)), | ||
%% Ensure that Node2 is in a list of joined nodes | ||
?assertMatch([Node1, Node2], maps:get(joined_nodes, Status)), | ||
%% Ensure that send_ping_result was called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is unnecessary because it just says receive_message(send_ping_result_called)
only in different words.
test/cets_SUITE.erl
Outdated
%% Ensure that Node2 is in a list of joined nodes | ||
?assertMatch([Node1, Node2], maps:get(joined_nodes, Status)), | ||
%% Ensure that send_ping_result was called | ||
%% (it is not called if node is in the nodes() list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...but this one I don't get at all. Which node? And previous line says "ensure it's called" while this one says "it is not called"... very confusing.
ee5db7e
to
02fb836
Compare
Make waiting condition into send_ping_result
02fb836
to
c0c4fb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better and more readable now, fine for me 👍
Includes Fix unavailableNodes list having joined nodes esl/cets#45
Includes Fix unavailableNodes list having joined nodes esl/cets#45
Ping result with pang could arrive after nodeup
Fix for wrong list in unavailableNodes :
Tested with:
esl/MongooseIM#4185
Tested with Helm tests.