<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/tests/unittests/test_datasource/test_gce.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 GCE metadata fetch to init-local (SC-502) (#1122)</title>
<updated>2021-12-02T14:51:26+00:00</updated>
<author>
<name>James Falcon</name>
<email>james.falcon@canonical.com</email>
</author>
<published>2021-12-02T14:51:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=cf38c2cbc5875813fbb9858f45e5b95789b7ffea'/>
<id>urn:sha1:cf38c2cbc5875813fbb9858f45e5b95789b7ffea</id>
<content type='text'>
GCE currently fetches metadata after network has come up. There's no
reason we can't fetch at init-local time, so update GCE to fetch at
init-local time to be more performant and consistent with other
datasources.</content>
</entry>
<entry>
<title>testing: mock sleep in gce unit tests (#1072)</title>
<updated>2021-10-18T17:34:31+00:00</updated>
<author>
<name>James Falcon</name>
<email>james.falcon@canonical.com</email>
</author>
<published>2021-10-18T17:34:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=70f0ee78ce4926cb79f37e13568deba298321016'/>
<id>urn:sha1:70f0ee78ce4926cb79f37e13568deba298321016</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix two minor warnings (#475)</title>
<updated>2020-07-13T15:37:37+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-07-13T15:37:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=fecbd81889011e8a75badd18935297f3494fe485'/>
<id>urn:sha1:fecbd81889011e8a75badd18935297f3494fe485</id>
<content type='text'>
</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>Replace mock library with unittest.mock (#186)</title>
<updated>2020-01-29T21:55:39+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-01-29T21:55:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=5f8f85bb38cc972d3d2c705a1ec73db3f690f323'/>
<id>urn:sha1:5f8f85bb38cc972d3d2c705a1ec73db3f690f323</id>
<content type='text'>
* cloudinit: replace "import mock" with "from unittest import mock"

* test-requirements.txt: drop mock

Co-authored-by: Chad Smith &lt;chad.smith@canonical.com&gt;
</content>
</entry>
<entry>
<title>Add support for publishing host keys to GCE guest attributes</title>
<updated>2019-08-09T17:11:05+00:00</updated>
<author>
<name>Rick Wright</name>
<email>rickw@google.com</email>
</author>
<published>2019-08-09T17:11:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=155847209e6a3ed5face91a133d8488a703f3f93'/>
<id>urn:sha1:155847209e6a3ed5face91a133d8488a703f3f93</id>
<content type='text'>
This adds an empty publish_host_keys() method to the default datasource
that is called by cc_ssh.py. This feature can be controlled by the
'ssh_publish_hostkeys' config option. It is enabled by default but can
be disabled by setting 'enabled' to false. Also, a blacklist of key
types is supported.

In addition, this change implements ssh_publish_hostkeys() for the GCE
datasource, attempting to write the hostkeys to the instance's guest
attributes. Using these hostkeys for ssh connections is currently
supported by the alpha version of Google's 'gcloud' command-line tool.

(On Google Compute Engine, this feature will be enabled by setting the
'enable-guest-attributes' metadata key to 'true' for the
project/instance that you would like to use this feature for. When
connecting to the instance for the first time using 'gcloud compute ssh'
the hostkeys will be read from the guest attributes for the instance and
written to the user's local known_hosts file for Google Compute Engine
instances.)
</content>
</entry>
<entry>
<title>tests: Avoid using https in httpretty, improve HttPretty test case.</title>
<updated>2018-05-23T20:04:42+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-05-23T20:04:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=12799d96f85e210c8e1216a3b06d8a98468fedd7'/>
<id>urn:sha1:12799d96f85e210c8e1216a3b06d8a98468fedd7</id>
<content type='text'>
On OpenSuSE 42.3, we would get errors running
tests/unittests/test_handler/test_handler_chef.py
 - test_myhttps_nonet raises a UnmockedError
   No mocking was registered, and real connections are not allowed
 - test_myhttps_net raises SSLError
   ("bad handshake: SysCallError(32, 'EPIPE')",)

This fixes the errors by just using http instead of https.

Also it modifies the HttprettyTestCase to do the httpretty activate
and deactivate itself in setUp and tearDown.  Then we don't have to
decorate individual test_ methods.  Also, we set
   httpretty.HTTPretty.allow_net_connect = False
Test cases here should not reach out to a network resource.

LP: #1771659
</content>
</entry>
<entry>
<title>GCE: fix reading of user-data that is not base64 encoded.</title>
<updated>2018-03-01T22:39:16+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-03-01T22:39:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=40e77380e036a24fafe91a63d0cdefada4312348'/>
<id>urn:sha1:40e77380e036a24fafe91a63d0cdefada4312348</id>
<content type='text'>
Last set of changes to GCE datasource broke reading of user-data
unless the user had base64 encoded their user-data and also set
user-data-encoding to 'base64'.

This fixes the issue.

LP: #1752711
</content>
</entry>
<entry>
<title>tests: Fix attempted use of /run in a test case.</title>
<updated>2018-01-24T01:56:31+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-01-24T01:56:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=ccbe7f6e53eb243b5c869d4f927b93b47e5cb8cd'/>
<id>urn:sha1:ccbe7f6e53eb243b5c869d4f927b93b47e5cb8cd</id>
<content type='text'>
The previous commit added a test that would attempt to create and use
/run/cloud-init/.  This just modifies it to use a temp dir instead.
</content>
</entry>
</feed>
