<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/tests/unittests/test_handler/test_handler_runcmd.py, branch 22.1</title>
<subtitle> (mirror of https://github.com/marekm72/vyos-cloud-init.git)
</subtitle>
<id>https://git.amelek.net/marekm72/vyos-cloud-init.git/atom?h=22.1</id>
<link rel='self' href='https://git.amelek.net/marekm72/vyos-cloud-init.git/atom?h=22.1'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/marekm72/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/marekm72/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: 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/marekm72/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>Allow comments in runcmd and report failed commands correctly (#1049)</title>
<updated>2021-10-07T20:08:13+00:00</updated>
<author>
<name>Brett Holman</name>
<email>bpholman5@gmail.com</email>
</author>
<published>2021-10-07T20:08:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/marekm72/vyos-cloud-init.git/commit/?id=725a7f7f19eb39b472e1f24b447fc9a596bf1748'/>
<id>urn:sha1:725a7f7f19eb39b472e1f24b447fc9a596bf1748</id>
<content type='text'>
Allow comments in runcmd and report failed commands correctly

A `runcmd` script may fail to parse properly, but does not mark
`runcmd` as failed when that occurs. Additionally `shellify()` fails
to correctly parse scripts that contain a comment line.

Rectify both issues and add unit tests to verify correct behavior.

LP: #1853146</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/marekm72/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>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/marekm72/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/marekm72/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: Centralize and re-use skipTest based on json schema presense.</title>
<updated>2018-03-14T16:41:46+00:00</updated>
<author>
<name>Scott Moser</name>
<email>smoser@ubuntu.com</email>
</author>
<published>2018-03-14T16:41:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/marekm72/vyos-cloud-init.git/commit/?id=76460b63f9c310c7de4e5f0c11d1525bedd277e1'/>
<id>urn:sha1:76460b63f9c310c7de4e5f0c11d1525bedd277e1</id>
<content type='text'>
This just centralizes a hunk of duplicated code and uses it from the
new location.
</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/marekm72/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>schema cli: Add schema subcommand to cloud-init cli and cc_runcmd schema</title>
<updated>2017-08-23T02:06:20+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2017-08-23T02:06:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/marekm72/vyos-cloud-init.git/commit/?id=cc9762a2d737ead386ffb9f067adc5e543224560'/>
<id>urn:sha1:cc9762a2d737ead386ffb9f067adc5e543224560</id>
<content type='text'>
This branch does a few things:
  - Add 'schema' subcommand to cloud-init CLI for validating
    cloud-config files against strict module jsonschema definitions
  - Add --annotate parameter to 'cloud-init schema' to annotate
    existing cloud-config file content with validation errors
  - Add jsonschema definition to cc_runcmd
  - Add unit test coverage for cc_runcmd
  - Update CLI capabilities documentation

This branch only imports development (and analyze) subparsers when the
specific subcommand is provided on the CLI to avoid adding costly unused
file imports during cloud-init system boot.

The schema command allows a person to quickly validate a cloud-config text
file against cloud-init's known module schemas to avoid costly roundtrips
deploying instances in their cloud of choice. As of this branch, only
cc_ntp and cc_runcmd cloud-config modules define schemas. Schema
validation will ignore all undefined config keys until all modules define
a strict schema.

To perform validation of runcmd and ntp sections of a cloud-config file:
$ cat &gt; cloud.cfg &lt;&lt;EOF
runcmd: bogus
EOF
$ python -m cloudinit.cmd.main schema --config-file cloud.cfg

$ python -m cloudinit.cmd.main schema --config-file cloud.cfg \
  --annotate

Once jsonschema is defined for all ~55 cc modules, we will move this
schema subcommand up as a proper subcommand of the cloud-init CLI.
</content>
</entry>
</feed>
