Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Fixed tmpdir leakage in integration tests (#78)
Browse files Browse the repository at this point in the history
* Fixed tmpdir leakage in integration tests

* Fixed tests
  • Loading branch information
apourchet authored Nov 29, 2018
1 parent cd99b96 commit c4194f3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/python/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def test_build_commit_empty_pair(registry1, storage_dir, cache_dir, tmpdir):
new_image1 = new_image_name()
new_image2 = new_image_name()
context_dir = os.path.join(os.getcwd(), 'testdata/build-context/commit-empty-pair')
test_file = tmpdir.mkdir("d1").join("f1")
test_file.write("hello")
test_file = tmpdir.join("f1")
test_file.write("")

# First build, mount in test file.
additional_volumes = {test_file: '/mnt/f1'}
Expand All @@ -126,13 +126,15 @@ def test_build_commit_empty_pair(registry1, storage_dir, cache_dir, tmpdir):
assert code == 0, err


def test_build_with_cache(registry1, storage_dir, cache_dir):
def test_build_with_cache(registry1, storage_dir, cache_dir, tmpdir):
utils.registry_ensure_image('debian:8', registry1.addr)
new_image1 = new_image_name()
new_image2 = new_image_name()
context_dir = os.path.join(os.getcwd(), 'testdata/build-context/mount')
_, test_file = tempfile.mkstemp(dir='/tmp') # TODO: prevent leaking if test failed
_, test_file2 = tempfile.mkstemp(dir='/tmp') # TODO: prevent leadking if test failed
test_file = tmpdir.join("f1")
test_file.write("")
test_file2 = tmpdir.join("f2")
test_file2.write("")

# First build, mount in test file.
additional_volumes = {test_file: '/tmp/test.txt', test_file2: '/root/mounted.txt'}
Expand Down

0 comments on commit c4194f3

Please sign in to comment.