summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-08-06 15:32:15 +0200
committerJürg Billeter <j@bitron.ch>2019-08-20 07:41:23 +0200
commit6613dd90fd5b497633da61291c7dc63c7b1f6092 (patch)
tree1e6bbe13293e06c706101eaf2eea651aa4a7a1d6 /tests
parent3e8b021464a87a61a9b16cb4970ecc12acc3b958 (diff)
downloadbuildstream-6613dd90fd5b497633da61291c7dc63c7b1f6092.tar.gz
casserver.py: Call CASCache.release_resources() on exit
Install a signal handler to execute cleanup also on SIGTERM. This will be used to terminate the buildbox-casd child process.
Diffstat (limited to 'tests')
-rw-r--r--tests/testutils/artifactshare.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index a5522c8eb..42ac6a6af 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -84,24 +84,24 @@ class ArtifactShare():
self.free_space = self.total_space
os.statvfs = self._mock_statvfs
- server = create_server(self.repodir,
- max_head_size=self.max_head_size,
- min_head_size=self.min_head_size,
- enable_push=True)
- port = server.add_insecure_port('localhost:0')
+ with create_server(self.repodir,
+ max_head_size=self.max_head_size,
+ min_head_size=self.min_head_size,
+ enable_push=True) as server:
+ port = server.add_insecure_port('localhost:0')
- server.start()
+ server.start()
- # Send port to parent
- q.put(port)
+ # Send port to parent
+ q.put(port)
+
+ # Sleep until termination by signal
+ signal.pause()
except Exception:
q.put(None)
raise
- # Sleep until termination by signal
- signal.pause()
-
# has_object():
#
# Checks whether the object is present in the share