Commit 1c6539da authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

burnin: Add --temp-directory option

This option is used to specify a temp directory to be used
by burnin to save it's intermediate files. The default
value for this option is "/tmp/"
parent 8aad91af
......@@ -190,6 +190,10 @@ def parse_arguments(args):
help="Turn off log output and only print the contents of the log "
"file at the end of the test. Useful when burnin is used in "
"script files and it's output is to be sent using email")
"--temp-directory", action="store",
default="/tmp/", dest="temp_directory",
help="Directory to use for saving temporary files")
(opts, args) = parser.parse_args(args)
......@@ -36,7 +36,6 @@ Common utils for burnin tests
import os
import re
import shutil
import unittest
......@@ -194,6 +193,7 @@ class BurninTests(unittest.TestCase):
images = None
flavors = None
delete_stale = False
temp_directory = None
quotas = Proper(value=None)
......@@ -271,13 +271,8 @@ class BurninTests(unittest.TestCase):
return username
def _create_tmp_directory(self):
"""Create a tmp directory
In my machine /tmp has not enough space for an image
to be saves, so we are going to use the current directory.
temp_dir = tempfile.mkdtemp(dir=os.getcwd())
"""Create a tmp directory"""
temp_dir = tempfile.mkdtemp(dir=self.temp_directory)"Temp directory %s created", temp_dir)
return temp_dir
......@@ -574,6 +569,7 @@ def initialize(opts, testsuites, stale_testsuites):
BurninTests.flavors = opts.flavors
BurninTests.images = opts.images
BurninTests.delete_stale = opts.delete_stale
BurninTests.temp_directory = opts.temp_directory
BurninTests.run_id = SNF_TEST_PREFIX + \
datetime.datetime.strftime(curr_time, "%Y%m%d%H%M%S")
......@@ -85,7 +85,7 @@ class PithosTestSuite(BurninTests):
def test_004_upload_file(self):
"""Test uploading a txt file to Pithos"""
# Create a tmp file
with tempfile.TemporaryFile() as fout:
with tempfile.TemporaryFile(dir=self.temp_directory) as fout:
fout.write("This is a temp file"), 0)
# Upload the file,
......@@ -97,7 +97,7 @@ class PithosTestSuite(BurninTests):
def test_005_download_file(self):
"""Test downloading the file from Pithos"""
# Create a tmp directory to save the file
with tempfile.TemporaryFile() as fout:
with tempfile.TemporaryFile(dir=self.temp_directory) as fout:
self.clients.pithos.download_object("test.txt", fout)
# Now read the file, 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment