test: fix float point number compare
This commit is contained in:
parent
243a30dacb
commit
d1e773d83c
|
@ -377,10 +377,14 @@ t_reset_metrics(_Config) ->
|
|||
end
|
||||
|| _ <- lists:seq(1,10)],
|
||||
emqx_rule_metrics:reset_metrics(Id),
|
||||
?assertEqual(#{exception => 0,failed => 0,
|
||||
matched => 0,no_result => 0,passed => 0,
|
||||
speed => 0.0,speed_last5m => 0.0,speed_max => 0},
|
||||
emqx_rule_metrics:get_rule_metrics(Id)),
|
||||
Expected = #{exception => 0, failed => 0, matched => 0, no_result => 0,
|
||||
passed => 0, speed => 0.0, speed_last5m => 0.0, speed_max => 0},
|
||||
Got = emqx_rule_metrics:get_rule_metrics(Id),
|
||||
%% use == instead of =:=, so that 0 and 0.0 are compared equal
|
||||
case Expected == Got of
|
||||
true -> ok;
|
||||
false -> ?assertEqual(Expected, Got)
|
||||
end,
|
||||
?assertEqual(#{failed => 0, success => 0, taken => 0},
|
||||
emqx_rule_metrics:get_action_metrics(ResId)),
|
||||
emqtt:stop(Client),
|
||||
|
|
Loading…
Reference in New Issue