<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/cloudinit/config/tests/test_snap.py, branch rolling</title>
<subtitle> (mirror of https://github.com/vyos/vyos-cloud-init.git)
</subtitle>
<id>https://git.amelek.net/vyos/vyos-cloud-init.git/atom?h=rolling</id>
<link rel='self' href='https://git.amelek.net/vyos/vyos-cloud-init.git/atom?h=rolling'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/'/>
<updated>2021-12-03T20:11:46+00:00</updated>
<entry>
<title>Reorganize unit test locations under tests/unittests (#1126)</title>
<updated>2021-12-03T20:11:46+00:00</updated>
<author>
<name>Brett Holman</name>
<email>bholman.devel@gmail.com</email>
</author>
<published>2021-12-03T20:11:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=039c40f9b3d88ee8158604bb18ca4bf2fb5d5e51'/>
<id>urn:sha1:039c40f9b3d88ee8158604bb18ca4bf2fb5d5e51</id>
<content type='text'>
This attempts to standardize unit test file location under test/unittests/
such that any source file located at cloudinit/path/to/file.py may have a
corresponding unit test file at test/unittests/path/to/test_file.py.

Noteworthy Comments:
====================
Four different duplicate test files existed:
test_{gpg,util,cc_mounts,cc_resolv_conf}.py
Each of these duplicate file pairs has been merged together. This is a
break in git history for these files.

The test suite appears to have a dependency on test order. Changing test
order causes some tests to fail. This should be rectified, but for now
some tests have been modified in
tests/unittests/config/test_set_passwords.py.

A helper class name starts with "Test" which causes pytest to try
executing it as a test case, which then throws warnings "due to Class
having __init__()".  Silence by changing the name of the class.

# helpers.py is imported in many test files, import paths change
cloudinit/tests/helpers.py -&gt; tests/unittests/helpers.py

# Move directories:
cloudinit/distros/tests -&gt; tests/unittests/distros
cloudinit/cmd/devel/tests -&gt; tests/unittests/cmd/devel
cloudinit/cmd/tests -&gt; tests/unittests/cmd/
cloudinit/sources/helpers/tests -&gt; tests/unittests/sources/helpers
cloudinit/sources/tests -&gt; tests/unittests/sources
cloudinit/net/tests -&gt; tests/unittests/net
cloudinit/config/tests -&gt; tests/unittests/config
cloudinit/analyze/tests/ -&gt; tests/unittests/analyze/

# Standardize tests already in tests/unittests/
test_datasource -&gt; sources
test_distros -&gt; distros
test_vmware -&gt; sources/vmware
test_handler -&gt; config        # this contains cloudconfig module tests
test_runs -&gt; runs</content>
</entry>
<entry>
<title>Move subp into its own module. (#416)</title>
<updated>2020-06-08T16:49:12+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@brickies.net</email>
</author>
<published>2020-06-08T16:49:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=3c551f6ebc12f7729a2755c89b19b9000e27cc88'/>
<id>urn:sha1:3c551f6ebc12f7729a2755c89b19b9000e27cc88</id>
<content type='text'>
This was painful, but it finishes a TODO from cloudinit/subp.py.

It moves the following from util to subp:
  ProcessExecutionError
  subp
  which
  target_path

I moved subp_blob_in_tempfile into cc_chef, which is its only caller.
That saved us from having to deal with it using write_file
and temp_utils from subp (which does not import any cloudinit things now).

It is arguable that 'target_path' could be moved to a 'path_utils' or
something, but in order to use it from subp and also from utils,
we had to get it out of utils.</content>
</entry>
<entry>
<title>cc_snap: validate that assertions property values are strings (#370)</title>
<updated>2020-05-21T15:16:35+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-05-21T15:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=98a6d9a0da82a764943c9495d7f21f3acc5ccd05'/>
<id>urn:sha1:98a6d9a0da82a764943c9495d7f21f3acc5ccd05</id>
<content type='text'>
And add an example of providing a list of assertions.</content>
</entry>
<entry>
<title>cc_snap: apply validation to snap.commands properties (#364)</title>
<updated>2020-05-18T17:30:27+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-05-18T17:30:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=8bcf1c069d8ddf28898342e541254bdeb54445df'/>
<id>urn:sha1:8bcf1c069d8ddf28898342e541254bdeb54445df</id>
<content type='text'>
Specifically, ensure that given values are either strings, or arrays of strings.</content>
</entry>
<entry>
<title>cloudinit: minor pylint fixes (#360)</title>
<updated>2020-05-14T19:39:19+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-05-14T19:39:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=09492b1d0f4b1826a7a98709c61d48bf14a1ec64'/>
<id>urn:sha1:09492b1d0f4b1826a7a98709c61d48bf14a1ec64</id>
<content type='text'>
We recently discovered that pylint is failing to report some errors when
invoked across our entire codebase (see
https://github.com/PyCQA/pylint/issues/3611).  I've run pylint across
every Python file under cloudinit/[0], and this commit fixes the issues
so-discovered.

[0] find cloudinit/ -name "*.py" | xargs -n 1 -t .tox/pylint/bin/python -m pylint</content>
</entry>
<entry>
<title>cloudinit: replace "from six import X" imports (except in util.py) (#183)</title>
<updated>2020-01-31T15:15:31+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-01-31T15:15:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=1bb1896ec900622e02c1ffb59db4d3f2df4a964d'/>
<id>urn:sha1:1bb1896ec900622e02c1ffb59db4d3f2df4a964d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests: Disallow use of util.subp except for where needed.</title>
<updated>2018-09-05T16:02:25+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-09-05T16:02:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=a8dcad9ac62bb1d2a4f7489960395bad6cac9382'/>
<id>urn:sha1:a8dcad9ac62bb1d2a4f7489960395bad6cac9382</id>
<content type='text'>
In many cases, cloud-init uses 'util.subp' to run a subprocess.
This is not really desirable in our unit tests as it makes the tests
dependent upon existance of those utilities.

The change here is to modify the base test case class (CiTestCase) to
raise exception any time subp is called.  Then, fix all callers.
For cases where subp is necessary or actually desired, we can use it
via
  a.) context hander CiTestCase.allow_subp(value)
  b.) class level self.allowed_subp = value

Both cases the value is a list of acceptable executable names that
will be called (essentially argv[0]).

Some cleanups in AltCloud were done as the code was being updated.
</content>
</entry>
<entry>
<title>schema: in validation, raise ImportError if strict but no jsonschema.</title>
<updated>2018-04-21T00:25:48+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-04-21T00:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=5037252ca5dc54c6d978b23dba063ac5fabc98fa'/>
<id>urn:sha1:5037252ca5dc54c6d978b23dba063ac5fabc98fa</id>
<content type='text'>
validate_cloudconfig_schema with strict=True would not actually validate
if there was no jsonschema available.  That seems kind of strange.
The change here is to make it raise an exception if strict was passed in.
And then to fix the one test that needed a skipIfJsonSchema wrapper.
</content>
</entry>
<entry>
<title>Schema: do not warn on duplicate items in commands.</title>
<updated>2018-04-19T02:37:07+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-04-19T02:37:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=6811926fdb991ad02ad9c0134c1d4bbe82ef87e1'/>
<id>urn:sha1:6811926fdb991ad02ad9c0134c1d4bbe82ef87e1</id>
<content type='text'>
runcmd, bootcmd, snap/commands, ubuntu-advantage/commands would
log warning (and fail if strict) on duplicate values in the commands.
But those should be allowed.  Example, it is perfectly valid to do:
   runcmd: ['sleep 1', 'sleep 1']

LP: #1764264
</content>
</entry>
<entry>
<title>tests: Fix newly added schema unit tests to skip if no jsonschema.</title>
<updated>2018-03-23T19:16:55+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-03-23T19:16:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=0c2f1ea29abc88957d21f56d432649989a8e4dfd'/>
<id>urn:sha1:0c2f1ea29abc88957d21f56d432649989a8e4dfd</id>
<content type='text'>
The recently added snap and ubuntu_advantage modules had unit tests
that exercised jsonschema.  Those throw error if jsonschema is
not present.  Fix to skip in that scenario.
</content>
</entry>
</feed>
