From 854b97c75c6d714e71780017d347987f205a160d Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Fri, 17 Apr 2015 11:05:55 +0800 Subject: [PATCH] change the way to make temp file Signed-off-by: Xian Chaobo --- test/integration/api.bats | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/integration/api.bats b/test/integration/api.bats index 7f60b4c297..ceea8a8db5 100644 --- a/test/integration/api.bats +++ b/test/integration/api.bats @@ -87,12 +87,11 @@ function teardown() { run docker_swarm run -d --name test_container busybox sleep 500 [ "$status" -eq 0 ] - temp_file_name="/tmp/export_file_$RANDOM.tar" - # make sure container exists and no comming file + temp_file_name=$(mktemp) + # make sure container exists run docker_swarm ps -l [ "${#lines[@]}" -eq 2 ] [[ "${lines[1]}" == *"test_container"* ]] - [ ! -f $temp_file_name ] # export, container->tar run docker_swarm export test_container > $temp_file_name @@ -259,12 +258,11 @@ function teardown() { run docker_swarm pull busybox [ "$status" -eq 0 ] - temp_file_name="/tmp/save_file_$RANDOM.tar" - # make sure busybox image exists and no comming file in current path + temp_file_name=$(mktemp) + # make sure busybox image exists run docker_swarm images [ "$status" -eq 0 ] [[ "${lines[*]}" == *"busybox"* ]] - [ ! -f $temp_file_name ] # save >, image->tar run docker_swarm save busybox > $temp_file_name @@ -283,12 +281,11 @@ function teardown() { run docker_swarm pull busybox [ "$status" -eq 0 ] - temp_file_name="/tmp/save_o_file_$RANDOM.tar" - # make sure busybox image exists and no comming file in current path + temp_file_name=$(mktemp) + # make sure busybox image exists run docker_swarm images [ "$status" -eq 0 ] [[ "${lines[*]}" == *"busybox"* ]] - [ ! -f $temp_file_name ] # save -o, image->tar run docker_swarm save -o $temp_file_name busybox