Skip to content

Commit

Permalink
vm_factory: Add clean_vm_template in setup
Browse files Browse the repository at this point in the history
Clean the vm_template dir before test executes.

Fixes: kata-containers#1363

Signed-off-by: Hui Zhu <[email protected]>
  • Loading branch information
teawater authored and jcvenegas committed Apr 9, 2019
1 parent 47f563c commit 932b600
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion integration/vm_factory/vm_templating_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ destroy_vm_template() {
echo "destroy vm template"
sudo -E PATH=$PATH "$kata_runtime_bin" factory destroy
# verify template is destroied
res=$(mount | grep template | wc -l)
res=$(mount | grep ${template_tmpfs_path} | wc -l)
[ $res -eq 0 ] || die "template factory is not cleaned up"
}

Expand All @@ -54,9 +54,19 @@ check_vm_template_factory() {
[ $res -eq 1 ] || die "template factory is not set up, missing state file"
}

clean_vm_template() {
while [ $(mount | grep ${template_tmpfs_path} | wc -l) -ne 0 ]
do
echo "cleaning vm template"
{ umount ${template_tmpfs_path} ; res=$?; } || true
[ $res -eq 0 ] || die "clean vm template failed"
done
}

setup() {
clean_env
extract_kata_env
clean_vm_template
}

check_qemu_for_vm_template() {
Expand Down

0 comments on commit 932b600

Please sign in to comment.