rename / simplify tester stub for now

Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Jason Volk 2024-04-29 13:56:04 -07:00 committed by June
parent b19d2ad5b0
commit 3585e8a2ef
6 changed files with 19 additions and 42 deletions

5
Cargo.lock generated
View file

@ -567,7 +567,6 @@ dependencies = [
"hickory-resolver",
"hmac",
"hot-lib-reloader",
"hot_lib",
"http 1.1.0",
"http-body-util",
"hyper 1.3.1",
@ -1347,10 +1346,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "hot_lib"
version = "0.1.0"
[[package]]
name = "html5ever"
version = "0.26.0"

View file

@ -16,19 +16,11 @@ edition = "2021"
# See also `rust-toolchain.toml`
rust-version = "1.76.0"
# for hot lib reload
[workspace]
members = ["hot_lib"]
[dependencies]
console-subscriber = { version = "0.1", optional = true }
# for hot lib reload
# see https://github.com/rksm/hot-lib-reloader-rs?tab=readme-ov-file#usage for more details if you are a dev
hot-lib-reloader = { version = "^0.7", optional = true }
hot_lib = { path = "hot_lib", optional = true }
# not sure if we need this, will anyone be using hot lib reload on release profile?
#no-mangle-if-debug = { version = "*" }
# Used for secure identifiers
rand = "0.8.5"
@ -408,7 +400,7 @@ perf_measurements = [
# incompatible with release_max_log_level
tokio_console = ["console-subscriber", "tokio/tracing"]
hot_reload = ["dep:hot-lib-reloader", "hot_lib"]
hot_reload = ["dep:hot-lib-reloader"]
hardened_malloc = ["hardened_malloc-rs"]

View file

@ -1,10 +0,0 @@
[package]
name = "hot_lib"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["rlib", "dylib"]
# cargo watch -w hot_lib -x 'build -p hot_lib'
# ^this will rebuild upon cargo detecting any changes

View file

@ -1,7 +0,0 @@
//! hot reloadable functions, generally called by the admin room test commands
//! see <https://github.com/rksm/hot-lib-reloader-rs?tab=readme-ov-file#usage> for more details if you are a dev
#[no_mangle]
pub fn test_command() {
println!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
}

View file

@ -26,10 +26,7 @@ use serde_json::value::to_raw_value;
use tokio::sync::{Mutex, MutexGuard};
use tracing::{error, warn};
use self::fsck::FsckCommand;
#[cfg(feature = "hot_reload")]
#[allow(unused_imports)]
use self::test_cmd::TestCommands;
use self::{fsck::FsckCommand, tester::TesterCommands};
use super::pdu::PduBuilder;
use crate::{
service::admin::{
@ -47,9 +44,7 @@ pub(crate) mod media;
pub(crate) mod query;
pub(crate) mod room;
pub(crate) mod server;
#[cfg(feature = "hot_reload")]
#[allow(unused_imports)]
pub(crate) mod test_cmd;
pub(crate) mod tester;
pub(crate) mod user;
const PAGE_SIZE: usize = 100;
@ -94,9 +89,8 @@ enum AdminCommand {
/// - Query all the database getters and iterators
Fsck(FsckCommand),
#[cfg(feature = "hot_reload")]
#[command(subcommand)]
Test(TestCommands),
Tester(TesterCommands),
}
#[derive(Debug)]
@ -314,8 +308,7 @@ impl Service {
AdminCommand::Debug(command) => debug::process(command, body).await?,
AdminCommand::Query(command) => query::process(command, body).await?,
AdminCommand::Fsck(command) => fsck::process(command, body).await?,
#[cfg(feature = "hot_reload")]
AdminCommand::Test(command) => test_cmd::process(command, body).await?,
AdminCommand::Tester(command) => tester::process(command, body).await?,
};
Ok(reply_message_content)

View file

@ -0,0 +1,14 @@
use ruma::events::room::message::RoomMessageEventContent;
use crate::Result;
#[cfg_attr(test, derive(Debug))]
#[derive(clap::Subcommand)]
pub(crate) enum TesterCommands {
Tester,
}
pub(crate) async fn process(command: TesterCommands, _body: Vec<&str>) -> Result<RoomMessageEventContent> {
Ok(match command {
TesterCommands::Tester => RoomMessageEventContent::notice_plain(String::from("complete")),
})
}