Webhook dispatch reimplementation as a tracer

This commit is contained in:
mdecimus
2024-07-30 18:53:05 +02:00
parent d29d21692e
commit 9840494094
17 changed files with 359 additions and 212 deletions

View File

@@ -267,10 +267,10 @@ pub async fn test(params: &mut JMAPTest) {
// Check webhook events
params.webhook.assert_contains(&[
"auth.failure",
"auth.success",
"auth.banned",
"\"login\": \"jdoe@example.com\"",
"\"accountType\": \"individual\"",
"authFailure",
"authSuccess",
"authBanned",
"\"name\": \"jdoe@example.com\"",
"\"type\": \"individual\"",
]);
}

View File

@@ -276,10 +276,7 @@ vrfy = true
[webhook."test"]
url = "http://127.0.0.1:8821/hook"
events = ["auth.success", "auth.failure", "auth.banned", "auth.error",
"message.accepted", "message.rejected", "message.appended",
"account.over-quota", "dsn", "double-bounce", "report.incoming.dmarc",
"report.incoming.tls", "report.incoming.arf", "report.outgoing"]
events = ["*"]
signature-key = "ovos-moles"
throttle = "100ms"
@@ -454,6 +451,7 @@ async fn init_jmap_tests(store_id: &str, delete_if_exists: bool) -> JMAPTest {
.cloned()
.unwrap_or_default(),
};
let tracers = Tracers::parse(&mut config);
let core = Core::parse(&mut config, stores, config_manager).await;
let store = core.storage.data.clone();
let shared_core = core.into_shared();
@@ -461,6 +459,9 @@ async fn init_jmap_tests(store_id: &str, delete_if_exists: bool) -> JMAPTest {
// Parse acceptors
servers.parse_tcp_acceptors(&mut config, shared_core.clone());
// Enable tracing
tracers.enable();
// Setup IPC channels
let (delivery_tx, delivery_rx) = mpsc::channel(IPC_CHANNEL_BUFFER);
let ipc = Ipc { delivery_tx };

View File

@@ -42,7 +42,7 @@ pub async fn test(params: &mut JMAPTest) {
tokio::time::sleep(Duration::from_millis(1000)).await;
// Check for events
params.webhook.assert_contains(&["auth.success"]);
params.webhook.assert_contains(&["authSuccess"]);
}
impl MockWebhookEndpoint {