feat: event ids, outbox identity migration
This commit is contained in:
@@ -67,3 +67,43 @@ async fn federation_off_build_wires_local_social() {
|
||||
"follower should be alice: {body}"
|
||||
);
|
||||
}
|
||||
|
||||
/// The server never talks to the bus: whatever `EVENT_BUS_BACKEND` says, a
|
||||
/// change and its event land in the outbox table. No NATS server is reachable here.
|
||||
#[tokio::test]
|
||||
async fn server_publishes_to_the_outbox_even_when_bus_is_nats() {
|
||||
let pool = support::memory_pool().await;
|
||||
let mut config = support::test_config();
|
||||
config.events.bus_backend = "nats".into();
|
||||
config.nats.url = Some("nats://127.0.0.1:1".into());
|
||||
let router = bootstrap::build_server_on(&config, pool.clone())
|
||||
.await
|
||||
.expect("server builds without a reachable NATS");
|
||||
let session = support::register(&router, "alice", "alice@example.com").await;
|
||||
|
||||
let (status, _, body) = support::send(
|
||||
&router,
|
||||
support::json_request(
|
||||
axum::http::Method::POST,
|
||||
"/api/v1/reviews",
|
||||
Some(&session.token),
|
||||
serde_json::json!({
|
||||
"manual_title": "Outbox",
|
||||
"manual_release_year": 2001,
|
||||
"rating": 4,
|
||||
"comment": "queued",
|
||||
"watched_at": "2024-01-01"
|
||||
}),
|
||||
),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, 201, "log review: {body}");
|
||||
|
||||
let queued: i64 = sqlx::query_scalar(
|
||||
"SELECT COUNT(*) FROM event_queue WHERE event_type = 'ReviewLogged' AND event_id IS NOT NULL",
|
||||
)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(queued, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user