Skip to content

Commit

Permalink
chore: add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
VivekPipaliya23 committed Feb 9, 2024
1 parent 81f8915 commit dced388
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/vmq_diversity/test/vmq_diversity_plugin_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ on_unsubscribe_test(_) ->

on_deliver_test(_) ->
ok = vmq_plugin:all_till_ok(on_deliver,
[username(), allowed_subscriber_id(), 1, topic(), payload(), false]).
[username(), allowed_subscriber_id(), 1, topic(), payload(), false, matched_acl()]).

on_offline_message_test(_) ->
[next] = vmq_plugin:all(on_offline_message, [allowed_subscriber_id(), 2,
Expand Down
7 changes: 5 additions & 2 deletions apps/vmq_events_sidecar/test/events_sidecar_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ on_deliver(#'eventssidecar.v1.OnDeliver'{username = BinPid,
qos = 1,
topic = ?TOPIC,
payload = ?PAYLOAD,
is_retain = false}) ->
is_retain = false,
matched_acl = #'eventssidecar.v1.MatchedACL'{name = ?LABEL, pattern = ?PATTERN}
}) ->
Pid = list_to_pid(binary_to_list(BinPid)),
Pid ! on_deliver_ok.

Expand All @@ -149,7 +151,8 @@ on_delivery_complete(#'eventssidecar.v1.OnDeliveryComplete'{username = BinPid,
qos = 1,
topic = ?TOPIC,
payload = ?PAYLOAD,
is_retain = false}) ->
is_retain = false,
matched_acl = #'eventssidecar.v1.MatchedACL'{name = ?LABEL, pattern = ?PATTERN}}) ->
Pid = list_to_pid(binary_to_list(BinPid)),
Pid ! on_delivery_complete_ok.

Expand Down
4 changes: 2 additions & 2 deletions apps/vmq_events_sidecar/test/vmq_events_sidecar_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ on_deliver_test(_) ->
enable_hook(on_deliver),
Self = pid_to_bin(self()),
ok = vmq_plugin:all_till_ok(on_deliver,
[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false]),
[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false, #matched_acl{name = ?LABEL, pattern = ?PATTERN}]),
ok = exp_response(on_deliver_ok),
disable_hook(on_deliver).

on_delivery_complete_test(_) ->
enable_hook(on_delivery_complete),
Self = pid_to_bin(self()),
[ok] = vmq_plugin:all(on_delivery_complete,[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false]),
[ok] = vmq_plugin:all(on_delivery_complete,[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false, #matched_acl{name = ?LABEL, pattern = ?PATTERN}]),
ok = exp_response(on_delivery_complete_ok),
disable_hook(on_delivery_complete).

Expand Down
4 changes: 2 additions & 2 deletions apps/vmq_webhooks/test/vmq_webhooks_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,14 @@ on_deliver_test(_) ->
register_hook(on_deliver, ?ENDPOINT),
Self = pid_to_bin(self()),
ok = vmq_plugin:all_till_ok(on_deliver,
[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false]),
[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false, #matched_acl{name = ?LABEL, pattern = ?PATTERN}]),
ok = exp_response(on_deliver_ok),
deregister_hook(on_deliver, ?ENDPOINT).

on_delivery_complete_test(_) ->
register_hook(on_delivery_complete, ?ENDPOINT),
Self = pid_to_bin(self()),
[next] = vmq_plugin:all(on_delivery_complete,[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false]),
[next] = vmq_plugin:all(on_delivery_complete,[Self, {?MOUNTPOINT, ?ALLOWED_CLIENT_ID}, 1, ?TOPIC, ?PAYLOAD, false, #matched_acl{name = ?LABEL, pattern = ?PATTERN}]),
ok = exp_response(on_delivery_complete_ok),
deregister_hook(on_delivery_complete, ?ENDPOINT).

Expand Down

0 comments on commit dced388

Please sign in to comment.