test(pulsar): fix flaky test

This commit is contained in:
Thales Macedo Garitezi 2024-03-06 12:04:29 -03:00
parent fc8b5d4522
commit eacd803a37
1 changed files with 18 additions and 12 deletions

View File

@ -212,20 +212,25 @@ t_action(Config) ->
?assertEqual(ReqPayload, emqx_utils_json:decode(RespPayload)), ?assertEqual(ReqPayload, emqx_utils_json:decode(RespPayload)),
ok = emqtt:disconnect(C1), ok = emqtt:disconnect(C1),
InstanceId = instance_id(actions, Name), InstanceId = instance_id(actions, Name),
#{counters := Counters} = emqx_resource:get_metrics(InstanceId), ?retry(
ok = delete_action(Name), 100,
ActionsAfterDelete = emqx_bridge_v2:list(actions), 20,
?assertNot(lists:any(Any, ActionsAfterDelete), ActionsAfterDelete),
?assertMatch( ?assertMatch(
#{ #{
counters := #{
dropped := 0, dropped := 0,
success := 1, success := 1,
matched := 1, matched := 1,
failed := 0, failed := 0,
received := 0 received := 0
}
}, },
Counters emqx_resource:get_metrics(InstanceId)
)
), ),
ok = delete_action(Name),
ActionsAfterDelete = emqx_bridge_v2:list(actions),
?assertNot(lists:any(Any, ActionsAfterDelete), ActionsAfterDelete),
ok. ok.
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
@ -292,7 +297,8 @@ pulsar_action(Config) ->
<<"pulsar_topic">> => ?config(pulsar_topic, Config) <<"pulsar_topic">> => ?config(pulsar_topic, Config)
}, },
<<"resource_opts">> => #{ <<"resource_opts">> => #{
<<"health_check_interval">> => <<"1s">> <<"health_check_interval">> => <<"1s">>,
<<"metrics_flush_interval">> => <<"300ms">>
} }
} }
} }