• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

emqx / ekka / 850

18 Dec 2024 02:02PM UTC coverage: 62.397% (-0.5%) from 62.861%
850

push

github

web-flow
Merge pull request #240 from keynslug/fix/EEC-112/autoheal-asymm

fix(autoheal): attempt healing complex asymmetric partitions

2 of 49 new or added lines in 2 files covered. (4.08%)

94 existing lines in 8 files now uncovered.

682 of 1093 relevant lines covered (62.4%)

49.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/src/ekka_boot.erl
1
%%--------------------------------------------------------------------
2
%% Copyright (c) 2019 EMQ Technologies Co., Ltd. All Rights Reserved.
3
%%
4
%% Licensed under the Apache License, Version 2.0 (the "License");
5
%% you may not use this file except in compliance with the License.
6
%% You may obtain a copy of the License at
7
%%
8
%%     http://www.apache.org/licenses/LICENSE-2.0
9
%%
10
%% Unless required by applicable law or agreed to in writing, software
11
%% distributed under the License is distributed on an "AS IS" BASIS,
12
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
%% See the License for the specific language governing permissions and
14
%% limitations under the License.
15
%%--------------------------------------------------------------------
16

17
-module(ekka_boot).
18

19
-export([apply_module_attributes/1, all_module_attributes/1]).
20

21
%% only {F, Args}...
22
apply_module_attributes(Name) ->
23
    [{Module, [apply(Module, F, Args) || {F, Args} <- Attrs]} ||
18✔
24
        {_App, Module, Attrs} <- all_module_attributes(Name)].
18✔
25

26
%% Copy from rabbit_misc.erl
27
all_module_attributes(Name) ->
28
    Targets =
19✔
29
        lists:usort(
30
          lists:append(
31
            [[{App, Module} || Module <- Modules] ||
76✔
32
                {App, _, _}   <- ignore_lib_apps(application:loaded_applications()),
19✔
33
                {ok, Modules} <- [application:get_key(App, modules)]])),
76✔
34
    lists:foldl(
19✔
35
      fun ({App, Module}, Acc) ->
36
              case lists:append([Atts || {N, Atts} <- module_attributes(Module),
2,850✔
37
                                         N =:= Name]) of
6,574✔
38
                  []   -> Acc;
2,850✔
UNCOV
39
                  Atts -> [{App, Module, Atts} | Acc]
×
40
              end
41
      end, [], Targets).
42

43
module_attributes(Module) ->
44
    case catch Module:module_info(attributes) of
2,850✔
45
        {'EXIT', {undef, [{Module, module_info, [attributes], []} | _]}} ->
UNCOV
46
            [];
×
47
        {'EXIT', Reason} ->
UNCOV
48
            exit(Reason);
×
49
        V ->
50
            V
2,850✔
51
    end.
52

53
ignore_lib_apps(Apps) ->
54
    LibApps = [kernel, stdlib, sasl, appmon, eldap, erts,
19✔
55
               syntax_tools, ssl, crypto, mnesia, os_mon,
56
               inets, goldrush, gproc, runtime_tools,
57
               snmp, otp_mibs, public_key, asn1, ssh, hipe,
58
               common_test, observer, webtool, xmerl, tools,
59
               test_server, compiler, debugger, eunit, et,
60
               wx],
61
    [App || App = {Name, _, _} <- Apps, not lists:member(Name, LibApps)].
19✔
62

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc