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

emqx / emqx / 8702269235

16 Apr 2024 08:17AM UTC coverage: 67.82% (-0.01%) from 67.831%
8702269235

push

github

web-flow
Merge pull request #12881 from keynslug/fix/ds-repl-flaky

fix(dsrepl): make replication-related tests more stable

11 of 17 new or added lines in 1 file covered. (64.71%)

32 existing lines in 11 files now uncovered.

37936 of 55936 relevant lines covered (67.82%)

7895.62 hits per line

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

86.76
/apps/emqx/src/emqx_reason_codes.erl
1
%%--------------------------------------------------------------------
2
%% Copyright (c) 2018-2024 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
%% @doc MQTT5 reason codes
18
-module(emqx_reason_codes).
19

20
-include("emqx_mqtt.hrl").
21

22
-export([
23
    name/1,
24
    name/2,
25
    text/1,
26
    text/2
27
]).
28

29
-export([
30
    frame_error/1,
31
    connack_error/1
32
]).
33

34
-export([compat/2]).
35

36
name(I, Ver) when Ver >= ?MQTT_PROTO_V5 ->
37
    name(I);
90✔
38
name(0, _Ver) ->
UNCOV
39
    connection_accepted;
×
40
name(1, _Ver) ->
41
    unacceptable_protocol_version;
4✔
42
name(2, _Ver) ->
43
    client_identifier_not_valid;
1✔
44
name(3, _Ver) ->
45
    server_unavaliable;
1✔
46
name(4, _Ver) ->
47
    malformed_username_or_password;
1✔
48
name(5, _Ver) ->
49
    unauthorized_client;
2✔
50
name(_, _Ver) ->
51
    unknown_error.
1✔
52

53
name(16#00) -> success;
8,657✔
54
name(16#01) -> granted_qos1;
×
55
name(16#02) -> granted_qos2;
1✔
56
name(16#04) -> disconnect_with_will_message;
13✔
57
name(16#10) -> no_matching_subscribers;
3✔
58
name(16#11) -> no_subscription_existed;
1✔
UNCOV
59
name(16#18) -> continue_authentication;
×
60
name(16#19) -> re_authenticate;
5✔
61
name(16#80) -> unspecified_error;
23✔
62
name(16#81) -> malformed_packet;
2✔
63
name(16#82) -> protocol_error;
25✔
64
name(16#83) -> implementation_specific_error;
8✔
65
name(16#84) -> unsupported_protocol_version;
2✔
66
name(16#85) -> client_identifier_not_valid;
74✔
67
name(16#86) -> bad_username_or_password;
5✔
68
name(16#87) -> not_authorized;
8✔
69
name(16#88) -> server_unavailable;
3✔
70
name(16#89) -> server_busy;
3✔
71
name(16#8A) -> banned;
4✔
UNCOV
72
name(16#8B) -> server_shutting_down;
×
73
name(16#8C) -> bad_authentication_method;
4✔
74
name(16#8D) -> keepalive_timeout;
6✔
75
name(16#8E) -> session_taken_over;
1✔
76
name(16#8F) -> topic_filter_invalid;
2✔
77
name(16#90) -> topic_name_invalid;
181✔
78
name(16#91) -> packet_identifier_inuse;
8✔
79
name(16#92) -> packet_identifier_not_found;
2✔
80
name(16#93) -> receive_maximum_exceeded;
5✔
81
name(16#94) -> topic_alias_invalid;
4✔
82
name(16#95) -> packet_too_large;
2✔
83
name(16#96) -> message_rate_too_high;
2✔
84
name(16#97) -> quota_exceeded;
17✔
85
name(16#98) -> administrative_action;
1✔
86
name(16#99) -> payload_format_invalid;
4✔
87
name(16#9A) -> retain_not_supported;
2✔
88
name(16#9B) -> qos_not_supported;
12✔
89
name(16#9C) -> use_another_server;
9✔
90
name(16#9D) -> server_moved;
4✔
91
name(16#9E) -> shared_subscriptions_not_supported;
4✔
92
name(16#9F) -> connection_rate_exceeded;
2✔
93
name(16#A0) -> maximum_connect_time;
1✔
94
name(16#A1) -> subscription_identifiers_not_supported;
5✔
95
name(16#A2) -> wildcard_subscriptions_not_supported;
3✔
96
name(_Code) -> unknown_error.
5✔
97

98
text(I, Ver) when Ver >= ?MQTT_PROTO_V5 ->
99
    text(I);
90✔
100
text(0, _Ver) ->
UNCOV
101
    <<"Connection accepted">>;
×
102
text(1, _Ver) ->
103
    <<"unacceptable_protocol_version">>;
4✔
104
text(2, _Ver) ->
105
    <<"client_identifier_not_valid">>;
1✔
106
text(3, _Ver) ->
107
    <<"server_unavaliable">>;
1✔
108
text(4, _Ver) ->
109
    <<"malformed_username_or_password">>;
1✔
110
text(5, _Ver) ->
111
    <<"unauthorized_client">>;
2✔
112
text(_, _Ver) ->
113
    <<"unknown_error">>.
1✔
114

115
text(16#00) -> <<"Success">>;
6✔
116
text(16#01) -> <<"Granted QoS 1">>;
×
117
text(16#02) -> <<"Granted QoS 2">>;
1✔
118
text(16#04) -> <<"Disconnect with Will Message">>;
3✔
UNCOV
119
text(16#10) -> <<"No matching subscribers">>;
×
120
text(16#11) -> <<"No subscription existed">>;
1✔
UNCOV
121
text(16#18) -> <<"Continue authentication">>;
×
122
text(16#19) -> <<"Re-authenticate">>;
5✔
123
text(16#80) -> <<"Unspecified error">>;
1✔
124
text(16#81) -> <<"Malformed Packet">>;
2✔
125
text(16#82) -> <<"Protocol Error">>;
1✔
126
text(16#83) -> <<"Implementation specific error">>;
1✔
127
text(16#84) -> <<"Unsupported Protocol Version">>;
2✔
UNCOV
128
text(16#85) -> <<"Client Identifier not valid">>;
×
129
text(16#86) -> <<"Bad User Name or Password">>;
1✔
130
text(16#87) -> <<"Not authorized">>;
1✔
131
text(16#88) -> <<"Server unavailable">>;
3✔
132
text(16#89) -> <<"Server busy">>;
3✔
133
text(16#8A) -> <<"Banned">>;
4✔
UNCOV
134
text(16#8B) -> <<"Server shutting down">>;
×
135
text(16#8C) -> <<"Bad authentication method">>;
2✔
136
text(16#8D) -> <<"Keep Alive timeout">>;
4✔
137
text(16#8E) -> <<"Session taken over">>;
1✔
UNCOV
138
text(16#8F) -> <<"Topic Filter invalid">>;
×
139
text(16#90) -> <<"Topic Name invalid">>;
2✔
140
text(16#91) -> <<"Packet Identifier in use">>;
4✔
141
text(16#92) -> <<"Packet Identifier not found">>;
2✔
UNCOV
142
text(16#93) -> <<"Receive Maximum exceeded">>;
×
143
text(16#94) -> <<"Topic Alias invalid">>;
2✔
144
text(16#95) -> <<"Packet too large">>;
2✔
145
text(16#96) -> <<"Message rate too high">>;
2✔
146
text(16#97) -> <<"Quota exceeded">>;
3✔
147
text(16#98) -> <<"Administrative action">>;
1✔
148
text(16#99) -> <<"Payload format invalid">>;
4✔
149
text(16#9A) -> <<"Retain not supported">>;
2✔
UNCOV
150
text(16#9B) -> <<"QoS not supported">>;
×
UNCOV
151
text(16#9C) -> <<"Use another server">>;
×
152
text(16#9D) -> <<"Server moved">>;
4✔
153
text(16#9E) -> <<"Shared Subscriptions not supported">>;
4✔
154
text(16#9F) -> <<"Connection rate exceeded">>;
2✔
155
text(16#A0) -> <<"Maximum connect time">>;
1✔
156
text(16#A1) -> <<"Subscription Identifiers not supported">>;
5✔
157
text(16#A2) -> <<"Wildcard Subscriptions not supported">>;
3✔
158
text(_Code) -> <<"Unknown error">>.
5✔
159

160
compat(connack, 16#80) -> ?CONNACK_PROTO_VER;
1✔
161
compat(connack, 16#81) -> ?CONNACK_PROTO_VER;
2✔
162
compat(connack, 16#82) -> ?CONNACK_PROTO_VER;
3✔
163
compat(connack, 16#83) -> ?CONNACK_PROTO_VER;
4✔
164
compat(connack, 16#84) -> ?CONNACK_PROTO_VER;
2✔
165
compat(connack, 16#85) -> ?CONNACK_INVALID_ID;
55✔
166
compat(connack, 16#86) -> ?CONNACK_CREDENTIALS;
2✔
167
compat(connack, 16#87) -> ?CONNACK_AUTH;
6✔
UNCOV
168
compat(connack, 16#88) -> ?CONNACK_SERVER;
×
169
compat(connack, 16#89) -> ?CONNACK_SERVER;
4✔
170
compat(connack, 16#8A) -> ?CONNACK_AUTH;
1✔
171
compat(connack, 16#8B) -> ?CONNACK_SERVER;
1✔
UNCOV
172
compat(connack, 16#8C) -> ?CONNACK_AUTH;
×
173
compat(connack, 16#90) -> ?CONNACK_SERVER;
×
174
compat(connack, 16#97) -> ?CONNACK_SERVER;
3✔
175
compat(connack, 16#9C) -> ?CONNACK_SERVER;
1✔
176
compat(connack, 16#9D) -> ?CONNACK_SERVER;
2✔
177
compat(connack, 16#9F) -> ?CONNACK_SERVER;
3✔
178
compat(suback, Code) when Code =< ?QOS_2 -> Code;
14,676✔
179
compat(suback, Code) when Code >= 16#80 -> 16#80;
6✔
180
%% TODO: 16#80(qos0) 16#81(qos1) 16#82(qos2) for mqtt-v3.1.1
181
compat(unsuback, _Code) -> undefined;
8✔
182
compat(_Other, _Code) -> undefined.
55✔
183

184
frame_error(frame_too_large) -> ?RC_PACKET_TOO_LARGE;
1✔
185
frame_error(_) -> ?RC_MALFORMED_PACKET.
2✔
186

187
connack_error(protocol_error) -> ?RC_PROTOCOL_ERROR;
×
188
connack_error(bad_username_or_password) -> ?RC_BAD_USER_NAME_OR_PASSWORD;
12✔
189
connack_error(not_authorized) -> ?RC_NOT_AUTHORIZED;
15✔
190
connack_error(server_unavailable) -> ?RC_SERVER_UNAVAILABLE;
10✔
191
connack_error(server_busy) -> ?RC_SERVER_BUSY;
13✔
192
connack_error(banned) -> ?RC_BANNED;
12✔
193
connack_error(bad_authentication_method) -> ?RC_BAD_AUTHENTICATION_METHOD;
6✔
194
connack_error(_) -> ?RC_UNSPECIFIED_ERROR.
42✔
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