MCPcopy Create free account
hub / github.com/Qovery/engine / test_command_with_timeout

Function test_command_with_timeout

lib-engine/src/cmd/command.rs:454–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

452
453 #[test]
454 fn test_command_with_timeout() {
455 let mut cmd = QoveryCommand::new("sleep", &["120"], &[]);
456 let ret = cmd.exec_with_abort(&mut |_| {}, &mut |_| {}, &CommandKiller::from_timeout(Duration::from_secs(2)));
457
458 assert!(matches!(ret, Err(CommandError::TimeoutError(_))));
459
460 let mut cmd = QoveryCommand::new("sh", &["-c", "cat /dev/urandom | grep -a --null-data ."], &[]);
461 cmd.kill_grace_period = Duration::from_secs(2);
462 let ret = cmd.exec_with_abort(&mut |_| {}, &mut |_| {}, &CommandKiller::from_timeout(Duration::from_secs(2)));
463
464 assert!(matches!(ret, Err(CommandError::TimeoutError(_))));
465
466 let mut cmd = QoveryCommand::new("sleep", &["1"], &[]);
467 let ret = cmd.exec_with_abort(&mut |_| {}, &mut |_| {}, &CommandKiller::from_timeout(Duration::from_secs(2)));
468 assert!(ret.is_ok());
469 }
470
471 #[test]
472 fn test_command_with_abort() {

Callers

nothing calls this directly

Calls 1

exec_with_abortMethod · 0.45

Tested by

no test coverage detected