-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integration tests for life cycle #113
Changes from all commits
27a0924
8fb3e18
3e6e899
239305c
884a88c
6a051ed
e88b3c6
3e6e933
13e97ab
847df4c
8b42965
345dc60
3c98b5e
83bc28a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
youki_integration_test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "youki_integration_test" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
uuid = "0.8" | ||
rand = "0.8.0" | ||
tar = "0.4" | ||
flate2 = "1.0" | ||
testanything = "0.2.1" | ||
anyhow = "1.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
TARGET=${TARGET-x86_64-unknown-linux-gnu} | ||
if [ "$TARGET" != "" ]; then | ||
TGT="--target $TARGET" | ||
fi | ||
VERSION=debug | ||
if [[ "$1" == "--release" ]]; then | ||
VERSION=release | ||
fi | ||
|
||
cargo build --verbose $TGT $1 | ||
rm -f youki_integration_test | ||
cp target/$TARGET/$VERSION/youki_integration_test . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::process::{Command, Stdio}; | ||
|
||
// TODO Allow to receive arguments. | ||
// TODO Wrapping up the results | ||
pub fn exec(project_path: &Path, id: &str) -> bool { | ||
let status = Command::new(project_path.join(PathBuf::from("youki"))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be your thoughts on using cmd args instead of env vars? That way we user won't have to define env vars specifically for this purpose, and it might make more sense to pass those as args to the command, rather than to set them as general env vars. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @utamoku What do you think about this? |
||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.arg("-r") | ||
.arg(project_path.join("integration-workspace").join("youki")) | ||
.arg("create") | ||
.arg(id) | ||
.arg("--bundle") | ||
.arg(project_path.join("integration-workspace").join("bundle")) | ||
.status() | ||
.expect("failed to execute process"); | ||
status.success() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::process::{Command, Stdio}; | ||
|
||
// TODO Allow to receive arguments. | ||
// TODO Wrapping up the results | ||
pub fn exec(project_path: &Path, id: &str) -> bool { | ||
let status = Command::new(project_path.join(PathBuf::from("youki"))) | ||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.arg("-r") | ||
.arg(project_path.join("integration-workspace").join("youki")) | ||
.arg("delete") | ||
.arg(id) | ||
.status() | ||
.expect("failed to execute process"); | ||
status.success() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::process::{Command, Stdio}; | ||
|
||
// TODO Allow to receive arguments. | ||
// TODO Wrapping up the results | ||
pub fn exec(project_path: &Path, id: &str) -> bool { | ||
let status = Command::new(project_path.join(PathBuf::from("youki"))) | ||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.arg("-r") | ||
.arg(project_path.join("integration-workspace").join("youki")) | ||
.arg("kill") | ||
.arg(id) | ||
.arg("9") | ||
.status() | ||
.expect("failed to execute process"); | ||
status.success() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub mod create; | ||
pub mod delete; | ||
pub mod kill; | ||
pub mod start; | ||
pub mod state; | ||
pub mod youki; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::process::{Command, Stdio}; | ||
|
||
// TODO Allow to receive arguments. | ||
// TODO Wrapping up the results | ||
pub fn exec(project_path: &Path, id: &str) -> bool { | ||
let status = Command::new(project_path.join(PathBuf::from("youki"))) | ||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.arg("-r") | ||
.arg(project_path.join("integration-workspace").join("youki")) | ||
.arg("start") | ||
.arg(id) | ||
.status() | ||
.expect("failed to execute process"); | ||
status.success() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::path::{Path, PathBuf}; | ||
use std::process::{Command, Stdio}; | ||
|
||
// TODO Allow to receive arguments. | ||
// TODO Wrapping up the results | ||
pub fn exec(project_path: &Path, id: &str) -> bool { | ||
let status = Command::new(project_path.join(PathBuf::from("youki"))) | ||
.stdout(Stdio::null()) | ||
.stderr(Stdio::null()) | ||
.arg("-r") | ||
.arg(project_path.join("integration-workspace").join("youki")) | ||
.arg("state") | ||
.arg(id) | ||
.status() | ||
.expect("failed to execute process"); | ||
status.success() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about error handling anyhow?