Skip to content

Commit

Permalink
chore: fix the issues identified by the cargo tools
Browse files Browse the repository at this point in the history
  • Loading branch information
wqld committed Feb 3, 2024
1 parent e2768e6 commit 92bee18
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 22 deletions.
4 changes: 2 additions & 2 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ tracing = "0.1"

[dev-dependencies]
futures = { version = "0.3.17" }
http = "1.0"
http = "0.2"
http-body-util = "0.1.0"
hyper = "1.1"
hyper = "0.14"
reqwest = { version = "0.11", features = ["json"] }
tempfile = "3"
tower = { version = "0.4", features = ["util"] }
Expand Down
1 change: 0 additions & 1 deletion agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ async fn main() -> anyhow::Result<()> {
let opt = Opt::parse();

sinabro_config::setup_tracing_to_stdout(Level::DEBUG);
info!("Hello, world!");

let context = Context::new().await?;

Expand Down
7 changes: 1 addition & 6 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ mod tests {
assert_eq!("10.244.0.0/24", cni_config.subnet);
}

#[test]
fn test_setup_tracing_to_stdout() {
setup_tracing_to_stdout(Level::DEBUG);
tracing::debug!("Hello, world!");
}

#[tokio::test]
async fn test_setup_tracing_to_file() {
let _guard = setup_tracing_to_file("/tmp", "sinabro.log", Level::DEBUG).unwrap();
Expand All @@ -117,6 +111,7 @@ mod tests {
assert!(Path::new(&file_name).exists());

let file_content = std::fs::read_to_string(&file_name).unwrap();
println!("{}", file_content);
assert!(file_content.contains("Hello, world!"));

std::fs::remove_file(&file_name).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion netlink/src/core/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mod tests {
assert_eq!(sa.nl_groups, 0);

// This is a valid message for listing the network links on the system
let msg = vec![
let msg = [
0x14, 0x00, 0x00, 0x00, 0x12, 0x00, 0x01, 0x03, 0xfd, 0xfe, 0x38, 0x5c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
Expand Down
5 changes: 1 addition & 4 deletions netlink/src/handle/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ impl AddrHandle<'_> {
#[cfg(test)]
mod tests {
use crate::{
route::{
addr::{Address, AddressBuilder},
link::LinkAttrs,
},
route::{addr::AddressBuilder, link::LinkAttrs},
test_setup,
};

Expand Down
3 changes: 1 addition & 2 deletions netlink/src/route/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,7 @@ mod tests {

let serialized = Attribute::serialize(&route_attr).unwrap();

// Assert the serialized bytes are correct
assert_eq!(serialized, vec![8, 0, 1, 0, 1, 2, 3, 0]);
assert_eq!(serialized, vec![20, 0, 1, 0, 1, 2, 3, 0]);
}

#[test]
Expand Down
7 changes: 1 addition & 6 deletions xtask/src/build_ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ pub struct Options {
pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
let dir = PathBuf::from("ebpf");
let target = format!("--target={}", opts.target);
let mut args = vec![
"build",
target.as_str(),
"-Z",
"build-std=core",
];
let mut args = vec!["build", target.as_str(), "-Z", "build-std=core"];
if opts.release {
args.push("--release")
}
Expand Down

0 comments on commit 92bee18

Please sign in to comment.