Skip to content

Commit 9243b4b

Browse files
committed
feat(main): add cache cmd for rust
1 parent 0300b26 commit 9243b4b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/main.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,32 @@ async fn main() -> anyhow::Result<()> {
1818
opts.cmd.execute(opts.base_opts.clone()).await?;
1919
Ok(())
2020
}
21+
22+
#[cfg(test)]
23+
mod tests {
24+
use super::*;
25+
use std::fs::File;
26+
use std::io::Write;
27+
use std::path::Path;
28+
use std::process::Command;
29+
30+
#[test]
31+
fn test_sealos_file() -> anyhow::Result<()> {
32+
let asset = Asset::get("sealos").unwrap();
33+
assert!(asset.data.len() > 0);
34+
let path = Path::new("sealos");
35+
let mut file = File::create(path)?;
36+
file.write_all(&asset.data)?;
37+
Command::new("chmod")
38+
.arg("a+x")
39+
.arg("sealos")
40+
.status()
41+
.expect("Failed to execute chmod");
42+
assert!(path.exists());
43+
Command::new("./sealos")
44+
.arg("version")
45+
.status()
46+
.expect("Failed to execute sealos");
47+
Ok(())
48+
}
49+
}

0 commit comments

Comments
 (0)