← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:cleanup/test-more-files-collect into cloud-init:master

 


Diff comments:

> diff --git a/tests/cloud_tests/platforms/lxd/instance.py b/tests/cloud_tests/platforms/lxd/instance.py
> index 0d697c0..e9b76a6 100644
> --- a/tests/cloud_tests/platforms/lxd/instance.py
> +++ b/tests/cloud_tests/platforms/lxd/instance.py
> @@ -29,6 +31,7 @@ class LXDInstance(Instance):
>              platform, name, properties, config, features)
>          self.tmpd = mkdtemp(prefix="%s-%s" % (type(self).__name__, name))

the type(self).__name__ gets the class name.
name is the isntance name.  (some long string).

so as it is, that is unrelated.

>          self._setup_console_log()
> +        self.name = name
>  
>      @property
>      def pylxd_container(self):
> diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
> index 1c5b540..2e0db73 100644
> --- a/tests/cloud_tests/testcases/base.py
> +++ b/tests/cloud_tests/testcases/base.py
> @@ -30,12 +30,14 @@ class CloudTestCase(unittest.TestCase):
>              raise AssertionError('Key "{}" not in cloud config'.format(name))
>          return self.cloud_config[name]
>  
> -    def get_data_file(self, name):
> +    def get_data_file(self, name, decode=True):
>          """Get data file failing test if it is not present."""
>          if name not in self.data:
>              raise AssertionError('File "{}" missing from collect data'
>                                   .format(name))
> -        return self.data[name]
> +        if not decode:
> +            return self.data[name]
> +        return self.data[name].decode()

well, we should specify utf-8 just for clarity. but i guess this was improved in python3.
python2 defaults to "the default encoding", which could be modified by the environment (via LANG or things).  in python3 the default is 'utf-8'.
so that is redundant from a python3 perspective, and tests/cloud_tests/ is python3 only, but  might as well specify.

>  
>      def get_instance_id(self):
>          """Get recorded instance id."""


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/336498
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:cleanup/test-more-files-collect into cloud-init:master.


References