mirror of https://github.com/LemmyNet/lemmy.git
ci fix
parent
76c6487390
commit
0f5b69cffc
|
@ -70,7 +70,8 @@ impl LemmyContext {
|
||||||
let rate_limit_cell = RateLimitCell::with_test_config();
|
let rate_limit_cell = RateLimitCell::with_test_config();
|
||||||
|
|
||||||
let context = LemmyContext::create(pool, client, secret, rate_limit_cell.clone());
|
let context = LemmyContext::create(pool, client, secret, rate_limit_cell.clone());
|
||||||
let config = FederationConfig::builder()
|
|
||||||
|
FederationConfig::builder()
|
||||||
.domain(context.settings().hostname.clone())
|
.domain(context.settings().hostname.clone())
|
||||||
.app_data(context)
|
.app_data(context)
|
||||||
.debug(true)
|
.debug(true)
|
||||||
|
@ -78,8 +79,7 @@ impl LemmyContext {
|
||||||
.http_fetch_limit(0)
|
.http_fetch_limit(0)
|
||||||
.build()
|
.build()
|
||||||
.await
|
.await
|
||||||
.expect("build federation config");
|
.expect("build federation config")
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
pub async fn init_test_context() -> Data<LemmyContext> {
|
pub async fn init_test_context() -> Data<LemmyContext> {
|
||||||
let config = Self::init_test_federation_config().await;
|
let config = Self::init_test_federation_config().await;
|
||||||
|
|
|
@ -41,4 +41,4 @@ url.workspace = true
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
tracing-test = "0.2.5"
|
tracing-test = "0.2.5"
|
||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
test-context = "0.3.0"
|
test-context = "0.3.0"
|
||||||
|
|
|
@ -422,10 +422,8 @@ mod test {
|
||||||
use std::{fs::File, io::BufReader};
|
use std::{fs::File, io::BufReader};
|
||||||
use test_context::{test_context, AsyncTestContext};
|
use test_context::{test_context, AsyncTestContext};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
select,
|
|
||||||
spawn,
|
spawn,
|
||||||
sync::mpsc::{error::TryRecvError, unbounded_channel, UnboundedReceiver},
|
sync::mpsc::{error::TryRecvError, unbounded_channel, UnboundedReceiver},
|
||||||
task::JoinHandle,
|
|
||||||
};
|
};
|
||||||
use tracing_test::traced_test;
|
use tracing_test::traced_test;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -462,8 +460,7 @@ mod test {
|
||||||
let (inbox_sender, inbox_receiver) = unbounded_channel();
|
let (inbox_sender, inbox_receiver) = unbounded_channel();
|
||||||
|
|
||||||
// listen for received activities in background
|
// listen for received activities in background
|
||||||
let cancel_ = cancel.clone();
|
let wait_stop_server = listen_activities(inbox_sender)?;
|
||||||
let wait_stop_server = listen_activities(inbox_sender, cancel_)?;
|
|
||||||
|
|
||||||
let fed_config = FederationWorkerConfig {
|
let fed_config = FederationWorkerConfig {
|
||||||
concurrent_sends_per_instance: 1,
|
concurrent_sends_per_instance: 1,
|
||||||
|
@ -578,10 +575,7 @@ mod test {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn listen_activities(
|
fn listen_activities(inbox_sender: UnboundedSender<String>) -> LemmyResult<ServerHandle> {
|
||||||
inbox_sender: UnboundedSender<String>,
|
|
||||||
cancel: CancellationToken,
|
|
||||||
) -> LemmyResult<ServerHandle> {
|
|
||||||
let run = HttpServer::new(move || {
|
let run = HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(actix_web::web::Data::new(inbox_sender.clone()))
|
.app_data(actix_web::web::Data::new(inbox_sender.clone()))
|
||||||
|
@ -616,7 +610,7 @@ mod test {
|
||||||
let form = SentActivityForm {
|
let form = SentActivityForm {
|
||||||
ap_id: Url::parse(&format!(
|
ap_id: Url::parse(&format!(
|
||||||
"http://local.com/activity/{}",
|
"http://local.com/activity/{}",
|
||||||
uuid::Uuid::new_v4().to_string()
|
uuid::Uuid::new_v4()
|
||||||
))?
|
))?
|
||||||
.into(),
|
.into(),
|
||||||
data: serde_json::from_reader(reader)?,
|
data: serde_json::from_reader(reader)?,
|
||||||
|
|
Loading…
Reference in New Issue