[Fuego] [PATCH 06/16] Allow the user to keep the container running after the test
Guilherme Campos Camargo
guicc at profusion.mobi
Thu Mar 29 00:08:22 UTC 2018
Through the `--remove-test-container` command line argument.
Signed-off-by: Guilherme Campos Camargo <guicc at profusion.mobi>
---
engine/tests/Functional.fuegotest/test_run.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index d6bec0c..fa68858 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -154,16 +154,20 @@ class ShExpect():
class FuegoContainer:
def __init__(self, install_script, image_name, container_name,
- jenkins_port):
+ jenkins_port, rm_after_test=True):
self.install_script = install_script
self.image_name = image_name
self.container_name = container_name
self.jenkins_port = jenkins_port
+ self.rm_after_test = rm_after_test
def __del__(self):
if self.container:
- LOGGER.debug('Removing Container')
- self.container.remove(force=True)
+ if self.rm_after_test:
+ LOGGER.debug('Removing Container')
+ self.container.remove(force=True)
+ else:
+ LOGGER.debug('Not Removing the test container')
def install(self):
self.docker_client = docker.APIClient()
@@ -453,13 +457,18 @@ def main():
'test container. Defaults to {}'
.format(DEFAULT_JENKINS_PORT),
default=DEFAULT_JENKINS_PORT, type=int)
+ parser.add_argument('--no-rm-container',
+ help='Do not remove the container after tests are '
+ 'complete.',
+ dest='rm_test_container', default=True, action='store_false')
args = parser.parse_args()
LOGGER.debug('Changing working dir to \'%s\'', args.working_dir)
os.chdir(args.working_dir)
container = FuegoContainer(args.install_script, args.image_name,
- args.container_name, args.jenkins_port)
+ args.container_name, args.jenkins_port,
+ rm_after_test=args.rm_test_container)
if not container.install():
return 1
--
2.16.2
More information about the Fuego
mailing list