[Fuego] [PATCH 06/16] Allow the user to keep the container running after the test

Tim.Bird at sony.com Tim.Bird at sony.com
Fri Mar 30 22:48:06 UTC 2018



> -----Original Message-----
> From: Guilherme Campos Camargo
> 
> Through the `--remove-test-container` command line argument.

Don't split a sentence in the commit description line and the
body of the commit description.  Also, the argument appears
to be '--no-rm-container'.  Description here was not helpful.

Also, there are extra spaces between 'running' and 'after' in the commit description.
Note sure what happened there.

> 
> 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
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego


More information about the Fuego mailing list