Skip to content

Commit

Permalink
test: add test cases for inspect --ps-tree-cmd
Browse files Browse the repository at this point in the history
Signed-off-by: Kouame Behouba Manasse <[email protected]>
  • Loading branch information
behouba committed Jul 12, 2023
1 parent 5f13edb commit f577912
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/checkpointctl.bats
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,47 @@ function teardown() {
[[ ${lines[0]} == *"failed to get process tree"* ]]
}

@test "Run checkpointctl inspect with tar file and --ps-tree-cmd" {
cp data/config.dump \
data/spec.dump "$TEST_TMP_DIR1"
mkdir "$TEST_TMP_DIR1"/checkpoint
cp test-imgs/pstree.img \
test-imgs/core-*.img \
test-imgs/pagemap-*.img \
test-imgs/pages-*.img \
test-imgs/mm-*.img "$TEST_TMP_DIR1"/checkpoint
( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . )
checkpointctl inspect "$TEST_TMP_DIR2"/test.tar --ps-tree-cmd
[ "$status" -eq 0 ]
[[ ${lines[8]} == *"Process tree"* ]]
[[ ${lines[9]} == *"piggie/piggie"* ]]
}

@test "Run checkpointctl inspect with tar file and --ps-tree-cmd and missing pages-*.img {
cp data/config.dump \
data/spec.dump "$TEST_TMP_DIR1"
mkdir "$TEST_TMP_DIR1"/checkpoint
cp test-imgs/pstree.img \
test-imgs/core-*.img \
test-imgs/pagemap-*.img \
test-imgs/mm-*.img "$TEST_TMP_DIR1"/checkpoint
( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . )
checkpointctl inspect "$TEST_TMP_DIR2"/test.tar --ps-tree-cmd
[ "$status" -eq 1 ]
[[ ${lines[0]} == *"failed to read process command line arguments"* ]]
}
@test "Run checkpointctl inspect with tar file and --ps-tree with --ps-tree-cmd" {
cp data/config.dump \
data/spec.dump "$TEST_TMP_DIR1"
mkdir "$TEST_TMP_DIR1"/checkpoint
( cd "$TEST_TMP_DIR1" && tar cf "$TEST_TMP_DIR2"/test.tar . )
checkpointctl inspect "$TEST_TMP_DIR2"/test.tar --ps-tree --ps-tree-cmd
[ "$status" -eq 1 ]
[[ ${lines[0]} == *"cannot use --ps-tree with --ps-tree-cmd"* ]]
}
@test "Run checkpointctl inspect with tar file and --files" {
cp data/config.dump \
data/spec.dump "$TEST_TMP_DIR1"
Expand Down

0 comments on commit f577912

Please sign in to comment.