Run garbage collector during probe test setUp
DatabaseBrokers cache opened connections. If a probe test instantiates a DatabaseBroker, or any other class that in turn instantiates a DatabaseBroker, such as a ContainerSharder, then connections may hold db files open until the DatabaseBroker is garbage collected. This can cause subsequent probe tests to fail during their setUp() because resetswift is unable to unmount device directories while db files are open. A call to gc.collect() is added during setUp() to ensure db files are closed before resetswift() is called. Closes-Bug: 1917050 Change-Id: Ifda4407c9ecff4c636fe07e013c3ebcebd0df018
This commit is contained in:
parent
1d34f321ac
commit
6ed82b106c
@ -16,6 +16,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import errno
|
||||
import gc
|
||||
import json
|
||||
import os
|
||||
from subprocess import Popen, PIPE
|
||||
@ -371,6 +372,10 @@ class ProbeTest(unittest.TestCase):
|
||||
self.configs['proxy-server'] = conf
|
||||
|
||||
def setUp(self):
|
||||
# previous test may have left DatabaseBroker instances in garbage with
|
||||
# open connections to db files which will prevent unmounting devices in
|
||||
# resetswift, so collect garbage now
|
||||
gc.collect()
|
||||
resetswift()
|
||||
kill_orphans()
|
||||
self._load_rings_and_configs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user