test: fix bridge api tests, metrics is now a separate api
This commit is contained in:
parent
bd65e8aad6
commit
31098d6c67
|
@ -313,9 +313,10 @@ t_ingress_mqtt_bridge_with_rules(_) ->
|
||||||
),
|
),
|
||||||
%% and also the rule should be matched, with matched + 1:
|
%% and also the rule should be matched, with matched + 1:
|
||||||
{ok, 200, Rule1} = request(get, uri(["rules", RuleId]), []),
|
{ok, 200, Rule1} = request(get, uri(["rules", RuleId]), []),
|
||||||
|
{ok, 200, Metrics} = request(get, uri(["rules", RuleId, "metrics"]), []),
|
||||||
|
?assertMatch(#{<<"id">> := RuleId}, jsx:decode(Rule1)),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"id">> := RuleId,
|
|
||||||
<<"metrics">> := #{
|
<<"metrics">> := #{
|
||||||
<<"matched">> := 1,
|
<<"matched">> := 1,
|
||||||
<<"passed">> := 1,
|
<<"passed">> := 1,
|
||||||
|
@ -332,8 +333,9 @@ t_ingress_mqtt_bridge_with_rules(_) ->
|
||||||
<<"actions.failed.unknown">> := 0
|
<<"actions.failed.unknown">> := 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
jsx:decode(Rule1)
|
jsx:decode(Metrics)
|
||||||
),
|
),
|
||||||
|
|
||||||
%% we also check if the actions of the rule is triggered
|
%% we also check if the actions of the rule is triggered
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
|
@ -429,24 +431,29 @@ t_egress_mqtt_bridge_with_rules(_) ->
|
||||||
timer:sleep(100),
|
timer:sleep(100),
|
||||||
emqx:publish(emqx_message:make(RuleTopic, Payload2)),
|
emqx:publish(emqx_message:make(RuleTopic, Payload2)),
|
||||||
{ok, 200, Rule1} = request(get, uri(["rules", RuleId]), []),
|
{ok, 200, Rule1} = request(get, uri(["rules", RuleId]), []),
|
||||||
#{
|
?assertMatch(#{<<"id">> := RuleId, <<"name">> := _}, jsx:decode(Rule1)),
|
||||||
<<"id">> := RuleId,
|
{ok, 200, Metrics} = request(get, uri(["rules", RuleId, "metrics"]), []),
|
||||||
<<"metrics">> := #{
|
?assertMatch(
|
||||||
<<"matched">> := 1,
|
#{
|
||||||
<<"passed">> := 1,
|
<<"metrics">> := #{
|
||||||
<<"failed">> := 0,
|
<<"matched">> := 1,
|
||||||
<<"failed.exception">> := 0,
|
<<"passed">> := 1,
|
||||||
<<"failed.no_result">> := 0,
|
<<"failed">> := 0,
|
||||||
<<"matched.rate">> := _,
|
<<"failed.exception">> := 0,
|
||||||
<<"matched.rate.max">> := _,
|
<<"failed.no_result">> := 0,
|
||||||
<<"matched.rate.last5m">> := _,
|
<<"matched.rate">> := _,
|
||||||
<<"actions.total">> := 1,
|
<<"matched.rate.max">> := _,
|
||||||
<<"actions.success">> := 1,
|
<<"matched.rate.last5m">> := _,
|
||||||
<<"actions.failed">> := 0,
|
<<"actions.total">> := 1,
|
||||||
<<"actions.failed.out_of_service">> := 0,
|
<<"actions.success">> := 1,
|
||||||
<<"actions.failed.unknown">> := 0
|
<<"actions.failed">> := 0,
|
||||||
}
|
<<"actions.failed.out_of_service">> := 0,
|
||||||
} = jsx:decode(Rule1),
|
<<"actions.failed.unknown">> := 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jsx:decode(Metrics)
|
||||||
|
),
|
||||||
|
|
||||||
%% we should receive a message on the "remote" broker, with specified topic
|
%% we should receive a message on the "remote" broker, with specified topic
|
||||||
?assert(
|
?assert(
|
||||||
receive
|
receive
|
||||||
|
|
Loading…
Reference in New Issue