Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profusion-mobi.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WbILrzU+r4r6USqRmn9BA4VVbo+x1IukyFIhPoo1P2s=; b=pdmeqkb82vkJDEmwyPSxxk+PtJ4M7bZzm2ozOJZuehotoawwv9EMsUc4e/J/oA1OkY +np14OaKWPGyaHY4nG6/pso3fg9CjdwfS2GBrHZeFh5vUYAag/a9fo3iS/tJzDVVXNmJ 7xNYYsgq4BjZrJFUBGw51gbQn3chYiX+iWmUaTbrGyqOtGq0hfOUB6AYYywqtqg/gD0a p3HwbTSJOHOBhgvQd4gx0CMbaR/6jVM5Kz0KTfoOZgKN94inJa3qt1yyEAs20UI6+BSh 0w+MQbW0TR1nSevAcEGpuOXfb1I/Ue+uLCHOIKiEORAY/cTGapRvx8RcoFb9WQeHWWjO TCSg== From: Guilherme Campos Camargo Date: Wed, 7 Mar 2018 16:54:55 -0300 Message-Id: <20180307195459.16757-8-guicc@profusion.mobi> In-Reply-To: <20180307195459.16757-1-guicc@profusion.mobi> References: <20180307195459.16757-1-guicc@profusion.mobi> Subject: [Fuego] [PATCH 07/11] Allow the user to keep the container running after the test List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Through the `--remove-test-container` command line argument. Signed-off-by: Guilherme Campos Camargo --- 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