From 3ce0f800a07217cca4938499ba88faadfb77de90 Mon Sep 17 00:00:00 2001 From: tomoron Date: Wed, 3 Jun 2026 14:44:20 +0200 Subject: [PATCH] tests for minecraft-server container, save rpc before changing control method --- .gitignore | 1 + src/rpc/mod.rs | 1 + src/rpc/rpc_client.rs | 17 +++++++++++++++++ src/rpc/socket.rs | 5 ++++- test.sh | 9 +++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/rpc/rpc_client.rs create mode 100644 test.sh diff --git a/.gitignore b/.gitignore index 193d5ff..5406463 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target .env tmp/ +servers/ diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs index ed01017..c6c97c3 100644 --- a/src/rpc/mod.rs +++ b/src/rpc/mod.rs @@ -3,3 +3,4 @@ mod socket; pub use socket::process_rpc_socket; pub mod actions; +pub mod rpc_client; diff --git a/src/rpc/rpc_client.rs b/src/rpc/rpc_client.rs new file mode 100644 index 0000000..3c064bb --- /dev/null +++ b/src/rpc/rpc_client.rs @@ -0,0 +1,17 @@ +pub struct RpcClient{ + pub read_buffer: Vec, + pub buffer: Vec, + + pub close: bool +} + +impl RpcClient { + pub fn new() -> Self { + Self { + read_buffer: vec![0; 1024], + buffer: vec![0; 10240], + + close: true + } + } +} diff --git a/src/rpc/socket.rs b/src/rpc/socket.rs index 24e22a9..672ad52 100644 --- a/src/rpc/socket.rs +++ b/src/rpc/socket.rs @@ -3,6 +3,8 @@ use tokio::net::TcpStream; use crate::DbPool; +use crate::rpc::rpc_client::RpcClient; + /* * request_format : @@ -19,5 +21,6 @@ use crate::DbPool; */ pub async fn process_rpc_socket(_stream: TcpStream, _pool: DbPool) -> io::Result<()> { - panic!("not implemented"); + let client = RpcClient::new(); + } diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..2c39b8a --- /dev/null +++ b/test.sh @@ -0,0 +1,9 @@ +docker run -v "$(pwd)/servers/potato:/data" \ + -e EULA=TRUE \ + -u 1000:100 \ + --rm \ + -e TYPE=VANILLA\ + -e VERSION="1.21.6" \ + -e DIFFICULTY="2" \ + -p 8080:8080 \ + -it itzg/minecraft-server:latest