forked from lavina/lavina
1
0
Fork 0
This commit is contained in:
Nikita Vilunov 2024-05-10 15:52:00 +02:00
parent 361946bc35
commit a740dc80fe
4 changed files with 26 additions and 12 deletions

View File

@ -20,5 +20,4 @@ addresses = []
[cluster.metadata] [cluster.metadata]
node_id = 0 node_id = 0
main_owner = 0 main_owner = 0
test_owner = 0 rooms = {}
test2_owner = 0

View File

@ -124,8 +124,7 @@ impl TestServer {
metadata: ClusterMetadata { metadata: ClusterMetadata {
node_id: 0, node_id: 0,
main_owner: 0, main_owner: 0,
test_owner: 0, rooms: Default::default(),
test2_owner: 0,
}, },
}; };
let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?; let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?;
@ -148,8 +147,7 @@ impl TestServer {
metadata: ClusterMetadata { metadata: ClusterMetadata {
node_id: 0, node_id: 0,
main_owner: 0, main_owner: 0,
test_owner: 0, rooms: Default::default(),
test2_owner: 0,
}, },
}; };
let TestServer { let TestServer {

View File

@ -1,8 +1,10 @@
use prometheus::Registry as MetricsRegistry;
use crate::{Authenticated, XmppConnection}; use crate::{Authenticated, XmppConnection};
use lavina_core::player::{PlayerConnection, PlayerId}; use lavina_core::clustering::{ClusterConfig, ClusterMetadata};
use lavina_core::player::PlayerConnection;
use lavina_core::repo::{Storage, StorageConfig}; use lavina_core::repo::{Storage, StorageConfig};
use lavina_core::LavinaCore; use lavina_core::LavinaCore;
use prometheus::Registry as MetricsRegistry;
use proto_xmpp::bind::{BindRequest, BindResponse, Jid, Name, Resource, Server}; use proto_xmpp::bind::{BindRequest, BindResponse, Jid, Name, Resource, Server};
pub(crate) struct TestServer { pub(crate) struct TestServer {
@ -19,7 +21,15 @@ impl TestServer {
db_path: ":memory:".into(), db_path: ":memory:".into(),
}) })
.await?; .await?;
let core = LavinaCore::new(metrics.clone(), storage.clone()).await?; let cluster_config = ClusterConfig {
metadata: ClusterMetadata {
node_id: 0,
main_owner: 0,
rooms: Default::default(),
},
addresses: vec![],
};
let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?;
Ok(TestServer { metrics, storage, core }) Ok(TestServer { metrics, storage, core })
} }
@ -27,7 +37,15 @@ impl TestServer {
self.core.shutdown().await?; self.core.shutdown().await?;
let metrics = MetricsRegistry::new(); let metrics = MetricsRegistry::new();
let core = LavinaCore::new(metrics.clone(), self.storage.clone()).await?; let cluster_config = ClusterConfig {
metadata: ClusterMetadata {
node_id: 0,
main_owner: 0,
rooms: Default::default(),
},
addresses: vec![],
};
let core = LavinaCore::new(metrics.clone(), cluster_config, self.storage.clone()).await?;
Ok(TestServer { Ok(TestServer {
metrics, metrics,

View File

@ -167,8 +167,7 @@ impl TestServer {
metadata: ClusterMetadata { metadata: ClusterMetadata {
node_id: 0, node_id: 0,
main_owner: 0, main_owner: 0,
test_owner: 0, rooms: Default::default(),
test2_owner: 0,
}, },
}; };
let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?; let core = LavinaCore::new(metrics.clone(), cluster_config, storage.clone()).await?;