<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/cloudinit/config/tests, branch mergify/bp/circinus/pr-85</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=mergify%2Fbp%2Fcircinus%2Fpr-85</id>
<link rel='self' href='https://git.amelek.net/vyos/vyos-cloud-init.git/atom?h=mergify%2Fbp%2Fcircinus%2Fpr-85'/>
<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>testing: monkeypatch system_info call in unit tests (SC-533) (#1117)</title>
<updated>2021-11-22T22:56:41+00:00</updated>
<author>
<name>James Falcon</name>
<email>james.falcon@canonical.com</email>
</author>
<published>2021-11-22T22:56:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=31daf6670aeeba1d452c70bc0d4d04139652be36'/>
<id>urn:sha1:31daf6670aeeba1d452c70bc0d4d04139652be36</id>
<content type='text'>
testing: monkeypatch system_info call in unit tests

system_info can make calls that read or write from the filesystem, which
should require special mocking. It is also decorated with 'lru_cache',
which means test authors often don't realize they need to be mocking.
Also, we don't actually want the results from the user's local
machine, so monkeypatching it across all tests should be reasonable.

Additionally, moved some of 'system_info` into a helper function to
reduce the surface area of the monkeypatch, added tests for the new
function (and fixed a bug as a result), and removed related mocks that
should be no longer needed.</content>
</entry>
<entry>
<title>Leave the details of service management to the distro (#1074)</title>
<updated>2021-10-20T20:58:27+00:00</updated>
<author>
<name>Andy Fiddaman</name>
<email>omnios@citrus-it.co.uk</email>
</author>
<published>2021-10-20T20:58:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=8c89009e75c7cf6c2f87635b82656f07f58095e1'/>
<id>urn:sha1:8c89009e75c7cf6c2f87635b82656f07f58095e1</id>
<content type='text'>
Various modules restart services and they all have logic to try and
detect if they are running on a system that needs 'systemctl' or
'service', and then have code to decide which order the arguments
need to be etc. On top of that, not all modules do this in the same way.

The duplication and different approaches are not ideal but this also
makes it hard to add support for a new distribution that does not use
either 'systemctl' or 'service'.

This change adds a new manage_service() method to the distro class
and updates several modules to use it.</content>
</entry>
<entry>
<title>testing: add get_cloud function (SC-461) (#1038)</title>
<updated>2021-10-16T00:53:42+00:00</updated>
<author>
<name>James Falcon</name>
<email>james.falcon@canonical.com</email>
</author>
<published>2021-10-16T00:53:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=a9501251aadf6d30192f7bd7debeabc9c3e29420'/>
<id>urn:sha1:a9501251aadf6d30192f7bd7debeabc9c3e29420</id>
<content type='text'>
Also added supporting distro/datasource classes and updated tests
that have a `get_cloud` call.</content>
</entry>
<entry>
<title>Add support for VMware PhotonOS (#909)</title>
<updated>2021-06-18T16:53:44+00:00</updated>
<author>
<name>sshedi</name>
<email>53473811+sshedi@users.noreply.github.com</email>
</author>
<published>2021-06-18T16:53:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=35aa9db6f8e2ba05d366776c0e8d97f52217e930'/>
<id>urn:sha1:35aa9db6f8e2ba05d366776c0e8d97f52217e930</id>
<content type='text'>
Also added a new (currently experimental) systemd-networkd renderer,
and includes a small refactor to cc_resolv_conf.py to support the
resolved.conf used by systemd-resolved.</content>
</entry>
<entry>
<title>write passwords only to serial console, lock down cloud-init-output.log (#847)</title>
<updated>2021-03-19T14:06:42+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2021-03-19T14:06:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=b794d426b9ab43ea9d6371477466070d86e10668'/>
<id>urn:sha1:b794d426b9ab43ea9d6371477466070d86e10668</id>
<content type='text'>
Prior to this commit, when a user specified configuration which would
generate random passwords for users, cloud-init would cause those
passwords to be written to the serial console by emitting them on
stderr.  In the default configuration, any stdout or stderr emitted by
cloud-init is also written to `/var/log/cloud-init-output.log`.  This
file is world-readable, meaning that those randomly-generated passwords
were available to be read by any user with access to the system.  This
presents an obvious security issue.

This commit responds to this issue in two ways:

* We address the direct issue by moving from writing the passwords to
  sys.stderr to writing them directly to /dev/console (via
  util.multi_log); this means that the passwords will never end up in
  cloud-init-output.log
* To avoid future issues like this, we also modify the logging code so
  that any files created in a log sink subprocess will only be
  owner/group readable and, if it exists, will be owned by the adm
  group.  This results in `/var/log/cloud-init-output.log` no longer
  being world-readable, meaning that if there are other parts of the
  codebase that are emitting sensitive data intended for the serial
  console, that data is no longer available to all users of the system.

LP: #1918303</content>
</entry>
<entry>
<title>cc_keys_to_console: add option to disable key emission (#811)</title>
<updated>2021-02-22T19:20:46+00:00</updated>
<author>
<name>Michael Hudson-Doyle</name>
<email>michael.hudson@canonical.com</email>
</author>
<published>2021-02-22T19:20:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=e384a5436560c9494118f0999c314982d4912d27'/>
<id>urn:sha1:e384a5436560c9494118f0999c314982d4912d27</id>
<content type='text'>
Specifically:

ssh:                                                                            
  emit_keys_to_console: false

We also port the cc_keys_to_console cloud tests to the new integration
testing framework, and add a test for this new option.

LP: #1915460</content>
</entry>
<entry>
<title>Support configuring SSH host certificates. (#660)</title>
<updated>2020-11-20T20:59:51+00:00</updated>
<author>
<name>Jonathan Lung</name>
<email>lungj@users.noreply.github.com</email>
</author>
<published>2020-11-20T20:59:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=66b4be8b6da188a0667bd8c86a25155b6f4f3f6c'/>
<id>urn:sha1:66b4be8b6da188a0667bd8c86a25155b6f4f3f6c</id>
<content type='text'>
Existing config writes keys to /etc/ssh after deleting files matching
a glob that includes certificate files. Since sshd looks for
certificates in the same directory as the keys, a host certificate
must be placed in this directory. This update enables the certificate's
contents to be specified along with the keys.

Co-authored-by: jonathan lung &lt;lungj@heresjono.com&gt;
Co-authored-by: jonathan lung &lt;jlung@kepler.space&gt;</content>
</entry>
<entry>
<title>cc_mounts: correctly fallback to dd if fallocate fails (#585)</title>
<updated>2020-10-20T21:13:37+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-10-20T21:13:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=5f8a2bbc5f26c7abafbc9bd3d1b1b655ffdcc1ae'/>
<id>urn:sha1:5f8a2bbc5f26c7abafbc9bd3d1b1b655ffdcc1ae</id>
<content type='text'>
`create_swap()` was previously catching and not re-raising the
ProcessExecutionError that indicated swap creation failure; this meant
that the fallback logic could never be triggered.

This commit adds the required re-raise (as well as removing a duplicated
log message).

LP: #1897099</content>
</entry>
<entry>
<title>Enable use of the caplog fixture in pytest tests, and add a cc_final_message test using it (#461)</title>
<updated>2020-06-30T17:17:40+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-06-30T17:17:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=66e114a660c53400e389f119781f378311b65108'/>
<id>urn:sha1:66e114a660c53400e389f119781f378311b65108</id>
<content type='text'>
caplog is only available in pytest itself from 3.0 onwards. In xenial, we only have pytest 2.8.7. However, in xenial we do have pytest-catchlog available (as python3-pytest-catchlog), so we use that where appropriate.</content>
</entry>
</feed>
