Skip to content

Commit ad5344e

Browse files
committed
test(plugin-tee): fix tests
1 parent ed5dbcd commit ad5344e

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

crates/pluginlab/tests/e2e_cli_host.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,40 @@ mod e2e_cli_host {
8989
.expect("Didn't get expected error output");
9090
}
9191

92+
#[test]
93+
fn test_without_permission_allow_all() {
94+
let project_root = find_project_root();
95+
println!("Setting current directory to: {:?}", project_root);
96+
std::env::set_current_dir(&project_root).unwrap();
97+
let mut session = spawn(
98+
&format!(
99+
"{} --dir tmp/filesystem --allow-write",
100+
&build_command(
101+
&["target/wasm32-wasip1/debug/plugin_tee.wasm"],
102+
"repl_logic_guest.wasm"
103+
)
104+
),
105+
Some(TEST_TIMEOUT),
106+
)
107+
.expect("Can't launch pluginlab");
108+
109+
session
110+
.exp_string("[Host] Starting REPL host...")
111+
.expect("Didn't see startup message");
112+
session
113+
.exp_string("[Host] Loading plugin:")
114+
.expect("Didn't see plugin loading message");
115+
session
116+
.exp_string("repl(0)>")
117+
.expect("Didn't see REPL prompt");
118+
session
119+
.send_line("tee documents/work/projects/alpha/.gitkeep")
120+
.expect("Failed to send command");
121+
session
122+
.exp_string("permission denied - Failed to create file 'documents/work/projects/alpha/.gitkeep' - Operation not permitted (os error 63)\r\nrepl(1)>")
123+
.expect("Didn't get expected output from tee plugin");
124+
}
125+
92126
#[test]
93127
fn test_with_wrong_version_of_plugin() {
94128
let crate_version = env!("CARGO_PKG_VERSION");

crates/pluginlab/tests/e2e_rust_plugins.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ mod e2e_rust_plugins {
181181
std::env::set_current_dir(&project_root).unwrap();
182182
let mut session = spawn(
183183
&format!(
184-
"{} --dir tmp/filesystem --allow-read",
184+
"{} --dir tmp/filesystem --allow-all",
185185
&build_command(
186186
&["plugin_tee.wasm", "plugin_echo.wasm", "plugin_cat.wasm"],
187187
"repl_logic_guest.wasm"
@@ -227,7 +227,7 @@ mod e2e_rust_plugins {
227227
std::env::set_current_dir(&project_root).unwrap();
228228
let mut session = spawn(
229229
&format!(
230-
"{} --dir tmp/filesystem --allow-read",
230+
"{} --dir tmp/filesystem --allow-all",
231231
&build_command(
232232
&["plugin_tee.wasm", "plugin_echo.wasm", "plugin_cat.wasm"],
233233
"repl_logic_guest.wasm"
@@ -273,7 +273,7 @@ mod e2e_rust_plugins {
273273
std::env::set_current_dir(&project_root).unwrap();
274274
let mut session = spawn(
275275
&format!(
276-
"{} --dir tmp/filesystem --allow-read",
276+
"{} --dir tmp/filesystem --allow-all",
277277
&build_command(
278278
&["plugin_tee.wasm", "plugin_echo.wasm", "plugin_cat.wasm"],
279279
"repl_logic_guest.wasm"
@@ -299,16 +299,16 @@ mod e2e_rust_plugins {
299299
.exp_string("hello\r\nrepl(0)>")
300300
.expect("Didn't get expected output from echo plugin");
301301
session
302-
.send_line("tee -a data/sample.csv")
302+
.send_line("tee -a documents/work/projects/alpha/.gitkeep")
303303
.expect("Failed to send command");
304304
session
305305
.exp_string("hello\r\nrepl(0)>")
306306
.expect("Didn't get expected output from tee plugin");
307307
session
308-
.send_line("cat data/sample.csv")
308+
.send_line("cat documents/work/projects/alpha/.gitkeep")
309309
.expect("Failed to send command");
310310
session
311-
.exp_string("id,name,age,city,active\r\n1,Alice,28,New York,true\r\n2,Bob,32,San Francisco,true\r\n3,Charlie,25,Chicago,false\r\n4,Diana,29,Boston,true\r\n5,Eve,35,Seattle,true\r\nhello\r\nrepl(0)>")
312-
.expect("Didn't get expected contents of sample.csv");
311+
.exp_string("# This file ensures the alpha directory is tracked in git\r\n# Deep nested directory for testing\r\n\r\nhello\r\nrepl(0)>")
312+
.expect("Didn't get expected contents of .gitkeep");
313313
}
314314
}

0 commit comments

Comments
 (0)