Skip to content

Commit

Permalink
Fix tests for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspustina committed Jan 8, 2020
1 parent 739511c commit f14d047
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
22 changes: 16 additions & 6 deletions contrib/linux.conf
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
[defaults]
timeout = 1

[hostinfo]
commands = ["dmesg"]

[[profile]]
name = "default"
commands = ["uptime", "vm_stat", "iostat"]

[[command]]
name = "dmesg"
title = "Last kernel messages"
command = '/bin/dmesg -T'
timeout = 1

[[command]]
name = "uptime"
title = "Current Load"
description = "Current load and uptime"
command = "/usr/bin/uptime"
timeout = 1
default_run = true

[[command]]
name = "vm_stat"
name = "vmstat"
title = "Virtual Memory statistics"
description = "Current memory usage and statistics in pages"
command = "vm_stat -c 5 1"
command = "/usr/bin/vmstat 5 1"
timeout = 5
default_run = true

[[command]]
name = "iostat"
title = "Kernel I/O statistics"
description = "Current I/O statistics per dev in KB"
command = "/usr/sbin/iostat -c 5 -K"
command = "/usr/bin/iostat -x 1 5"
timeout = 5
default_run = true

# vim: set ft=toml:
6 changes: 6 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,13 @@ mod tests {
fn execution_ok() {
init();

#[cfg(target_os = "macos")]
let command = Command::new("uname", r#"/usr/bin/uname -a"#, 5);
#[cfg(target_os = "macos")]
let expected = "Darwin";
#[cfg(target_os = "linux")]
let command = Command::new("uname", r#"/usr/uname -a"#, 5);
#[cfg(target_os = "linux")]
let expected = "Linux";

let res = command.exec();
Expand All @@ -220,7 +223,10 @@ mod tests {
fn execution_failed() {
init();

#[cfg(target_os = "macos")]
let command = Command::new("false", r#"/usr/bin/false"#, 1);
#[cfg(target_os = "linux")]
let command = Command::new("false", r#"/usr/false"#, 1);

let res = command.exec();

Expand Down

0 comments on commit f14d047

Please sign in to comment.