summaryrefslogtreecommitdiff
path: root/tox.ini
AgeCommit message (Collapse)Author
2022-02-14mypy: introduce type checking (#1254)Chris Patterson
All currently failing modules are excluded from reporting errors using follow-imports=silent and an exclusion list. Future work can whittle down this failing list. This change will start enforcing new modules and those currently passing. Includes some minor alphabetical reordering in tox.ini. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
2022-02-02Integration testing docs and refactor (#1231)James Falcon
* Include CI and Fixtures sections in integration test docs * Incorporate additional variable annotations * Remove unnecessary IntegrationInstance subclasses * Move setup_image teardown into its fixture
2022-01-31fix parallel tox execution (#1214)Brett Holman
2022-01-18tox: pass PYCLOUDLIB_* env vars into integration tests when present (#1196)Chad Smith
2022-01-10Remove 3.5 and xenial support (SC-711) (#1167)James Falcon
Includes: - Update tox.ini and .travis.yml accordingly - Cleanup tox.ini with new tox syntax and cloud-init dependencies - Update documentation accordingly - Replace/remove xenial references where additional testing isn't required - Remove xenial checks in integration tests - Replace yield_fixture with fixture in pytest tests Sections of code commented with lines like "Remove when Xenial is no longer supported" still exist as they're require additional testing.
2021-12-15Adopt Black and isort (SC-700) (#1157)James Falcon
Applied Black and isort, fixed any linting issues, updated tox.ini and CI.
2021-12-03Reorganize unit test locations under tests/unittests (#1126)Brett Holman
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 -> tests/unittests/helpers.py # Move directories: cloudinit/distros/tests -> tests/unittests/distros cloudinit/cmd/devel/tests -> tests/unittests/cmd/devel cloudinit/cmd/tests -> tests/unittests/cmd/ cloudinit/sources/helpers/tests -> tests/unittests/sources/helpers cloudinit/sources/tests -> tests/unittests/sources cloudinit/net/tests -> tests/unittests/net cloudinit/config/tests -> tests/unittests/config cloudinit/analyze/tests/ -> tests/unittests/analyze/ # Standardize tests already in tests/unittests/ test_datasource -> sources test_distros -> distros test_vmware -> sources/vmware test_handler -> config # this contains cloudconfig module tests test_runs -> runs
2021-10-22Remove pin in dependencies for jsonschema (#1078)James Falcon
In jsonschema 4, hostname validation was changed to have an optional dependency on the fqdn package. Since we don't have this dependency in cloud-init, attempting this validation will no longer fail for a string that isn't a valid hostname.
2021-10-07tox integration: pass the *_proxy, GOOGLE_*, GCP_* env vars (#1050)Paride Legovini
*_proxy: required for https_proxy and no_proxy GOOGLE_* and GCP_*: see [1]. https://cloud.google.com/functions/docs/configuring/env-var#runtime_environment_variables_set_automatically
2021-09-30pin jsonschema in requirements.txt (#1043)James Falcon
On unit tests, tox is attempting to install 4.0, which fails two of the unit tests, and fails python 3.5 as it is not compatible.
2021-09-29testing: remove cloud_tests (#1020)James Falcon
Cloud tests have been replaced with integration tests
2021-09-21tox: bump the pinned flake8 and pylint version (#1029)Paride Legovini
tox: bump the pinned flake8 and pylint version * pylint: fix W1406 (redundant-u-string-prefix) The u prefix for strings is no longer necessary in Python >=3.0. * pylint: disable W1514 (unspecified-encoding) From https://www.python.org/dev/peps/pep-0597/ (Python 3.10): The new warning stems form https://www.python.org/dev/peps/pep-0597, which says: Developers using macOS or Linux may forget that the default encoding is not always UTF-8. [...] Even Python experts may assume that the default encoding is UTF-8. This creates bugs that only happen on Windows. The warning could be fixed by always specifying encoding='utf-8', however we should be careful to not break environments which are not utf-8 (or explicitly state that only utf-8 is supported). Let's silence the warning for now. * _quick_read_instance_id: cover the case where load_yaml() returns None Spotted by pylint: - E1135 (unsupported-membership-test) - E1136 (unsubscriptable-object) LP: #1944414
2021-09-01Fix `make style-check` errors (#1000)Shreenidhi Shedi
Using flake8 inplace of pyflakes Renamed run-pyflakes -> run-flake8 Changed target name to flake8 in Makefile With pyflakes we can't suppress warnings/errors in few required places. flake8 is flexible in that regard. Hence using flake8 seems to be a better choice here. flake8 does the job of pep8 anyway. So, removed pep8 target from Makefile along with tools/run-pep8 script. Included setup.py in flake8 checks
2021-07-20Update pylint to v2.9.3 and fix the new issues it spots (#946)Paride Legovini
In CI run against pylint 2.9.3 and fix occurrences of: - W0237 (arguments-renamed) - W0402 (deprecated-module) The W0402 deprecated-module was about module `imp`: cloudinit/patcher.py:9: [W0402(deprecated-module), ] Uses of a deprecated module 'imp' The imp module is deprecated and replaced by importlib, which according to the documentation has no replacement for acquire_lock() and release_lock(), which are the only reason why `imp` is imported. Nothing about the code using this lock that actually requires it. Let's remove the locking code and the import altogether. Dropping the locking makes patcher.patch() an empty wrapper around _patch_logging(). Rename _patch_logging() to patch_logging() and call it directly instead. Drop patch().
2021-06-17tests: Add 'adhoc' mark for integration tests (#925)James Falcon
Also new jenkins tox definition
2021-05-14Add integration test for lp-1920939 (#891)James Falcon
In #856 we added the ability to use partprobe instead of blockdev for reading partitions. Test that partprobe succeeds where blockdev fails. Also add a mechanism to our integration tests to allow a callable to be called between `lxc init` and `lxc start`
2021-05-13Allow user control over update events (#834)James Falcon
Control is currently limited to boot events, though this should allow us to more easily incorporate HOTPLUG support. Disabling 'instance-first-boot' is not supported as we apply networking config too early in boot to have processed userdata (along with the fact that this would be a pretty big foot-gun). The concept of update events on datasource has been split into supported update events and default update events. Defaults will be used if there is no user-defined update events, but user-defined events won't be supplied if they aren't supported. When applying the networking config, we now check to see if the event is supported by the datasource as well as if it is enabled. Configuration looks like: updates: network: when: ['boot']
2021-04-15Emit dots on travis to avoid timeout (#867)James Falcon
The current method of running a background sleep until travis is finished is causing integration test runs to pass even when they should be failing. Instead, update the code to emit dots itself.
2021-03-19Fix apt default integration test (#845)James Falcon
The apt default test wasn't ported over from cloud-tests correctly. uri should be specified in the test, but it was not, so the test failed on openstack (and likely other platforms) because without a specified uri, the default uri will vary by platform. I separated this uri test out into a separate test function. Also add openstack specific test for apt configuration with no uri. Other platform-specific tests should be added here over time.
2021-03-03tox.ini: pass OS_* environment variables to integration tests (#830)Daniel Watkins
This allows source'd OpenStack credentials to be used for tox tests.
2021-02-22integration_tests: introduce lxd_use_exec mark (#802)Daniel Watkins
pycloudlib has modified the way LXD executes tests (https://github.com/canonical/pycloudlib/pull/114): it will always use SSH to access them by default, instead of using `lxc exec`. This behaviour is transparent for them majority of cloud-init's integration tests, but some currently depend on using `lxc exec` to access instances with (intentionally) broken networking: obviously these are not accessible via SSH. pycloudlib retains support for switching an instance to use `lxc exec`. This commit introduces the `lxd_use_exec` mark, which tests can use to indicate to the integration testing framework that they should be so switched, and applies it to all applicable tests.
2021-02-19azure: case-insensitive UUID to avoid new IID during kernel upgrade (#798)Chad Smith
Kernel's newer than 4.15 present /sys/dmi/id/product_uuid as a lowercase value. Previously UUID was uppercase. Azure datasource reads the product_uuid directly as their platform's instance-id. This presents a problem if a kernel is either upgraded or downgraded across the 4.15 kernel version boundary because the case of the UUID will change, resulting in cloud-init seeing a "new" instance id and re-running all modules. Re-running cc_ssh in cloud-init deletes and regenerates ssh_host keys on a system which can cause concern on long-running instances that somethingnefarious has happened. Also add: - An integration test for this for Azure Bionic Ubuntu FIPS upgrading from a FIPS kernel with uppercase UUID to a lowercase UUID in linux-azure - A new pytest.mark.sru_next to collect all integration tests related to our next SRU LP: #1835584
2021-02-18integration_tests: fix use of SSH agent within tox (#815)Daniel Watkins
We need to allow the SSH_AUTH_SOCK environment variable through for paramiko to be able to find the agent.
2021-01-26Stop linting cloud_tests (#791)James Falcon
The tox pylint command was failing because of competing dependencies in the multiple requirements files. Given that we plan on no longer updating cloud_tests, we also no longer need to lint them.
2021-01-12integration_tests: add integration test for LP: #1910835 (#761)Daniel Watkins
2020-12-09integration_tests: include timestamp in log output (#720)Daniel Watkins
2020-12-09integration_tests: add test for LP: #1898997 (#713)Daniel Watkins
integration_tests: add test for LP: #1898997 This introduces the `lxd_config_dict` mark, used to specify a free-form configuration dict to LXD for tests which only run there; and the `not_xenial` and `not_bionic` marks, used to skip tests on xenial/bionic via a basic release skipping mechanism. This also bumps the pycloudlib commit we depend upon, as the latest commit includes the changes required for LXD network config to work. (The `lxd_config_dict` change further complicated `_client`, so a minor refactoring is applied.)
2020-12-09Add integration test for power_state_change module (#717)James Falcon
Also introduce the `unstable` mark, to allow us to land tests which run inconsistently (such as this one).
2020-12-03integration_tests: introduce skipping of tests by OS (#702)Daniel Watkins
This introduces an optional, more complex OS_IMAGE format (`<image id>::<os>::<release>`) which allows the specification of the OS/OS release which the given image ID corresponds to. This information is used to skip tests which do not apply to the image. This commit is comprised of the following discrete changes: * introduce the IntegrationImage class, to handle parsing and storing the new OS_IMAGE format * support inferring the OS and OS release of Ubuntu series, so that we can continue to set OS_IMAGE to just a series name and have test skipping work * add documentation on Image Selection to integration_tests.rst * introduce the actual skipping behaviour based on OS marks * apply the `ubuntu` mark to all tests that should be skipped on non-Ubuntu operating systems
2020-11-24tox: avoid tox testenv subsvars for xenial support (#684)Chad Smith
Xenial tox 2.3.1 still suffers from https://github.com/tox-dev/tox/issues/208. As a result we cannot use testenv substvars if we want to support running tox on xenial systems. Drop the {[testenv:integration-tests]*} substitutions to avoid tracebacks when running `tox -e xenial-dev` which has the signature: "No support for the %s substitution type" % sub_type) tox.ConfigError: ConfigError: No support for the posargs substitution type
2020-11-23LXD VM support in integration tests (#678)James Falcon
2020-11-23Integration test for fallocate falling back to dd (#681)James Falcon
See #585
2020-11-20add integration test for LP: #1900837 (#679)Daniel Watkins
As the first test of this SRU cycle, this also introduces the sru_2020_11 mark to allow us to easily identify the set of tests generated for this SRU.
2020-11-18tox.ini: only select "ci" marked tests for CI runs (#677)Daniel Watkins
`-k` will select tests or marks whose names match. `-m` selects only tests which have the specified mark, so is more appropriate.
2020-11-18only run a subset of integration tests in CI (#672)Daniel Watkins
This introduces the "ci" mark, used to indicate a test which should run as part of our CI integration testing run and the integration-tests-ci tox environment, which runs only those tests. Travis has been adjusted to use this tox environment. (All current module tests have been marked with the "ci" mark, but the one bug test that we have has not.)
2020-11-10split integration and cloud_tests requirements (#652)Daniel Watkins
The cloud_tests and the integration_tests (via pycloudlib) have conflicting requirements. This commit splits up their requirements files, so we can accurately express the requirements for each.
2020-11-02integration_tests: various launch improvements (#638)Daniel Watkins
* integration_tests: fix passing launch_kwargs to session_cloud.launch * integration_tests: log the launch_kwargs before launching instances * integration_tests: add support for specifying instance name for tests Co-authored-by: Rick Harding <rharding@mitechie.com>
2020-10-06conftest.py: remove top-level import of httpretty (#599)Daniel Watkins
This means that the integration tests do not need to install test-requirements.txt in order to successfully import `conftest.py`.
2020-10-05tox.ini: add integration-tests testenv definition (#595)Daniel Watkins
2020-10-01Initial implementation of integration testing infrastructure (#581)James Falcon
2020-08-25tox: bump the pylint version to 2.6.0 in the default run (#544)Paride Legovini
Changes: tox: bump the pylint version to 2.6.0 in the default run Fix pylint 2.6.0 W0707 warnings (raise-missing-from)
2020-08-13tox.ini: pin correct version of httpretty in xenial{,-dev} envs (#531)Daniel Watkins
The version was bumped in c7248059dd2faaaadfbcef5c83e8e8ea166d6767 to support running on Python 3.7+ systems. Now that we have separate `xenial` and `xenial-dev` tox environments, we can restore the correct pinning for `xenial` without breaking `xenial-dev` on developer machines. Also drop the `mock` dependency from `xenial-shared-deps`; its removal was missed in 5f8f85bb38cc972d3d2c705a1ec73db3f690f323.
2020-08-10DataSourceOracle: refactor to use only OPC v1 endpoint (#493)Daniel Watkins
The /opc/v1/ metadata endpoints[0] are universally available in Oracle Cloud Infrastructure and the OpenStack endpoints are considered deprecated, so we can refactor the data source to use the OPC endpoints exclusively. This simplifies the datasource code substantially, and enables use of OPC-specific attributes in future. [0] https://docs.cloud.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm
2020-07-06cloudinit: fix tip-pylint failures and bump pinned pylint version (#478)Daniel Watkins
Specifically: * disable E1102 in cloudinit/sources/helpers/openstack.py for reasons described in a comment, and * refactor `abs_join` to require at least one positional argument; this matches os.path.join's signature, and that mismatch is what was causing pylint to emit a warning * bump to pylint 2.4.2
2020-07-02tests: use markers to configure disable_subp_usage (#473)Daniel Watkins
This is an improvement over indirect parameterisation for a few reasons: * The test code is much easier to read, the mark names are much more intuitive than the indirect parameterisation invocation, and there's less boilerplate to boot * The fixture no longer has to overload the single parameter that fixtures can take with multiple meanings
2020-06-30Enable use of the caplog fixture in pytest tests, and add a cc_final_message ↵Daniel Watkins
test using it (#461) 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.
2020-06-10test: fix all flake8 E126 errors (#425)Joshua Powers
2020-06-02test: fix all flake8 E121 and E123 errors (#404)Joshua Powers
This fixes issues with closing brackets not matching the opening bracket's line and continuation line under-idented for hanging indent.
2020-06-02test: fix all flake8 E241 (#403)Joshua Powers
Remove extra spaces after a ','
2020-06-02test: ignore flake8 E402 errors in main.py (#402)Joshua Powers
This puts an ignore on the imports not at the top of the file errors. The reason for the ignore instead of fix is that the file is using imp to grab a lock and patch logging before further imports are completed.