<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/cloudinit/tests/test_url_helper.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>Fix unit tests breaking from new httpretty version (#903)</title>
<updated>2021-05-14T17:48:52+00:00</updated>
<author>
<name>James Falcon</name>
<email>TheRealFalcon@users.noreply.github.com</email>
</author>
<published>2021-05-14T17:48:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=57964125205790f7803dbebfadc6c52ed195c6bf'/>
<id>urn:sha1:57964125205790f7803dbebfadc6c52ed195c6bf</id>
<content type='text'>
httpretty now logs all requests by default which gets mixed up with our
logging tests. Also we were incorrectly setting a logging level to
'None', which now also causes issues with the new httpretty version.
See https://github.com/gabrielfalcao/HTTPretty/pull/419</content>
</entry>
<entry>
<title>test: fix all flake8 E241 (#403)</title>
<updated>2020-06-02T15:24:29+00:00</updated>
<author>
<name>Joshua Powers</name>
<email>josh.powers@canonical.com</email>
</author>
<published>2020-06-02T15:24:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=5f7825e22241423322dbe628de1b00289cf34114'/>
<id>urn:sha1:5f7825e22241423322dbe628de1b00289cf34114</id>
<content type='text'>
Remove extra spaces after a ','</content>
</entry>
<entry>
<title>ec2: only redact token request headers in logs, avoid altering request (#230)</title>
<updated>2020-03-03T22:23:33+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2020-03-03T22:23:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=fa1abfec27050a4fb71cad950a17e42f9b43b478'/>
<id>urn:sha1:fa1abfec27050a4fb71cad950a17e42f9b43b478</id>
<content type='text'>
Our header redact logic was redacting both logged request headers and
the actual source request. This results in DataSourceEc2 sending the
invalid header "X-aws-ec2-metadata-token-ttl-seconds: REDACTED" which
gets an HTTP status response of 400.

Cloud-init retries this failed token request for 2 minutes before
falling back to IMDSv1.

LP: #1865882</content>
</entry>
<entry>
<title>Fix linting failure in test_url_helper (#83)</title>
<updated>2019-12-03T21:45:14+00:00</updated>
<author>
<name>Eric Lafontaine</name>
<email>eric.lafontaine@bell.ca</email>
</author>
<published>2019-12-03T21:45:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=c4735dd37c89f12569093e5d18e13493cae1ee0b'/>
<id>urn:sha1:c4735dd37c89f12569093e5d18e13493cae1ee0b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url_helper: read_file_or_url should pass headers param into readurl (#66)</title>
<updated>2019-12-02T23:24:18+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2019-12-02T23:24:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=f69d33a723b805fec3ee70c3a6127c8cadcb02d8'/>
<id>urn:sha1:f69d33a723b805fec3ee70c3a6127c8cadcb02d8</id>
<content type='text'>
Headers param was accidentally omitted and no longer passed through to
readurl due to a previous commit.

To avoid this omission of params in the future, drop positional param
definitions from read_file_or_url and pass all kwargs through to readurl
when we are not operating on a file.

In util:read_seeded, correct the case where invalid positional param
file_retries was being passed into read_file_or_url.

Also drop duplicated file:// prefix addition from read_seeded because
read_file_or_url does that work anyway.

LP: #1854084</content>
</entry>
<entry>
<title>azure: retry imds polling on requests.Timeout</title>
<updated>2018-11-13T03:14:58+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2018-11-13T03:14:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=6062595b83e08e0f12e1fe6d8e367d8db9d91ef8'/>
<id>urn:sha1:6062595b83e08e0f12e1fe6d8e367d8db9d91ef8</id>
<content type='text'>
There is an infrequent race when the booting instance can hit the IMDS
service before it is fully available. This results in a
requests.ConnectTimeout being raised.
Azure's retry_callback logic now retries on either 404s or Timeouts.

LP:1800223
</content>
</entry>
<entry>
<title>read_file_or_url: move to url_helper, fix bug in its FileResponse.</title>
<updated>2018-05-17T20:59:54+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-05-17T20:59:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=30e730f7ca111487d243ba9f40c66df6d7a49953'/>
<id>urn:sha1:30e730f7ca111487d243ba9f40c66df6d7a49953</id>
<content type='text'>
The result of a read_file_or_url on a file and on a url would differ
in behavior.
  str(UrlResponse) would return UrlResponse.contents.decode('utf-8')
while
  str(FileResponse) would return str(FileResponse.contents)

The difference being "b'foo'" versus "foo".

As part of the general goal of cleaning util, move read_file_or_url
into url_helper.
</content>
</entry>
<entry>
<title>relocate tests/unittests/helpers.py to cloudinit/tests</title>
<updated>2017-09-05T17:03:59+00:00</updated>
<author>
<name>Lars Kellogg-Stedman</name>
<email>lars@redhat.com</email>
</author>
<published>2017-09-05T17:03:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=a3649e03206a3596131413956ea7ecc18790ec73'/>
<id>urn:sha1:a3649e03206a3596131413956ea7ecc18790ec73</id>
<content type='text'>
This moves the base test case classes into into cloudinit/tests and
updates all the corresponding imports.
</content>
</entry>
<entry>
<title>url_helper: dynamically import oauthlib import from inside oauth_headers</title>
<updated>2017-08-30T19:41:17+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2017-08-29T16:32:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=b931a6473ee929193c0048640bf34876ce831a15'/>
<id>urn:sha1:b931a6473ee929193c0048640bf34876ce831a15</id>
<content type='text'>
oauth_headers is the only function which requires oauthlib, move the
import and ImportError handling inside this function to only attempt
loading at runtime if called. This will allow us to build on platforms
that don't have python-oauthlib installed by default. Add simple unittests
around the missing oauthlib dependencies to make sure the function
performs as intended and raises and NotImplementedError if oauthlib can't
be imported.
</content>
</entry>
</feed>
