mirror of
https://github.com/block/buzz.git
synced 2026-10-30 22:11:36 +00:00
Exercise authority admission with real Redis in lifecycle tests
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Signed-off-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//! Real-storage regressions for workflow wake lifecycle boundaries.
|
||||
use super::integration_tests::test_state;
|
||||
use super::integration_tests::test_state_with_redis;
|
||||
use super::*;
|
||||
use axum::{
|
||||
extract::{Path, State},
|
||||
@@ -23,7 +23,10 @@ struct Fixture {
|
||||
}
|
||||
impl Fixture {
|
||||
async fn new() -> Self {
|
||||
let state = test_state().await;
|
||||
let state = test_state_with_redis(
|
||||
std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://localhost:6379".into()),
|
||||
)
|
||||
.await;
|
||||
let owner = Keys::generate();
|
||||
let agent = Keys::generate();
|
||||
let host = format!("wake-{}.example", Uuid::new_v4().simple());
|
||||
@@ -161,7 +164,7 @@ impl Fixture {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore = "requires Postgres"]
|
||||
#[ignore = "requires Postgres and Redis"]
|
||||
async fn captured_revision_survives_replacement_but_not_revocation() {
|
||||
let f = Fixture::new().await;
|
||||
let a = f.revision(Timestamp::now().as_secs()).await;
|
||||
@@ -211,7 +214,7 @@ async fn captured_revision_survives_replacement_but_not_revocation() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore = "requires Postgres"]
|
||||
#[ignore = "requires Postgres and Redis"]
|
||||
async fn removed_open_channel_member_cannot_read_or_count_wakes() {
|
||||
let f = Fixture::new().await;
|
||||
let a = f.revision(Timestamp::now().as_secs()).await;
|
||||
@@ -281,7 +284,7 @@ async fn removed_open_channel_member_cannot_read_or_count_wakes() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore = "requires Postgres"]
|
||||
#[ignore = "requires Postgres and Redis"]
|
||||
async fn notification_failure_rolls_back_message_mentions_and_thread_metadata() {
|
||||
let f = Fixture::new().await;
|
||||
let message = EventBuilder::new(Kind::Custom(KIND_STREAM_MESSAGE as u16), "@Worker work")
|
||||
|
||||
@@ -920,10 +920,14 @@ pub(crate) mod postgres_tests {
|
||||
|
||||
/// Real-PG state mirroring `handlers::event::tests::test_state_with_redis_url`.
|
||||
pub(crate) async fn test_state() -> Arc<AppState> {
|
||||
test_state_with_redis("redis://127.0.0.1:1".to_string()).await
|
||||
}
|
||||
|
||||
pub(crate) async fn test_state_with_redis(redis_url: String) -> Arc<AppState> {
|
||||
let mut config = crate::config::Config::from_env().expect("default config loads");
|
||||
config.require_relay_membership = false;
|
||||
config.require_auth_token = false;
|
||||
config.redis_url = "redis://127.0.0.1:1".to_string();
|
||||
config.redis_url = redis_url;
|
||||
let pool = sqlx::PgPool::connect_lazy(&config.database_url).expect("lazy pg pool");
|
||||
let db = buzz_db::Db::from_pool(pool.clone());
|
||||
let redis_pool = deadpool_redis::Config::from_url(&config.redis_url)
|
||||
|
||||
Reference in New Issue
Block a user