summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases
AgeCommit message (Collapse)Author
2018-04-19pylint: pay attention to unused variable warnings.Scott Moser
This enables warnings produced by pylint for unused variables (W0612), and fixes the existing errors.
2018-04-18pycodestyle: Fix invalid escape sequences in string literals.Scott Moser
Python has deprecated these invalid string literals now https://bugs.python.org/issue27364 and pycodestyle is identifying them with a W605 warning. https://github.com/PyCQA/pycodestyle/pull/676 So basically, any use of \ not followed by one of [\'"abfnrtv] or \ooo (octal) \xhh (hex) or a newline is invalid. This is most comomnly seen for us in regex. To solve, you either: a.) use a raw string r'...' b.) correctly escape the \ that was not intended to be interpreted.
2018-04-12Implement ntp client spec with auto support for distro selectionRyan Harper
Add a base NTP client configuration dictionary and allow Distro specific changes to be merged. Add a select client function which implements logic to preferr installed clients over clients which need to be installed. Also allow distributions to override the cloud-init defaults. LP: #1749722
2018-04-07tests: fix ec2 integration network metadata validationChad Smith
Fix integraiton test logic for ec2 to look for network and availability-zone data under the key path 'ds'=>'meta-data' instead of just 'ds' when parsing instance-data.json.
2018-04-03correct documentation to match correct attribute name usage.Dominic Schlegel
LP: #1420018
2018-03-16cc_snap: Add new module to install and configure snapd and snap packages.Chad Smith
Support installing and configuring snaps on ubuntu systems. Now, cloud-config files can provide a list or dictionary of snap:assertions which will be allow configuration of snapd on a system via 'snap ack' calls. The snap:commands configuration option supports arbitrary system commands intended to interact with snappy's cli. This allows users to run arbitrary snappy commands to create users, download, install and configure snap packages and snapd. This branch also deprecates old snappy and snap_config modules leaving warnings in documentation and runtime for consumers of these modules. Deprecated snap* modules will be dropped in cloud-init v.18.2 release.
2018-03-08Make salt minion module work on FreeBSD.Dominic Schlegel
Previously the module was not working under FreeBSD due to a different package name and some different paths. The module now has OS specific default values which can even be customized via corresponding cloud config variables. LP: #1721503
2018-02-23salt: configure grains in grains file rather than in minion config.Daniel Wallace
While salt grains can be configured in the minion config file, it is usually better to configure it in the /etc/salt/grains file. This allows that to be done.
2018-01-25tests: Collect script output as binary, collect systemd journal, fix lxd.Scott Moser
This adds collection a gzip compressed systemd journal on systemd systems. The file can later be reviewed with:   zcat system.journal.gz > system.journal   journalctl --file=system.journal [-o short-monotonic ..] To support this:   * modify test harness infrastructure to not assume content is utf-8.   * fix lxd platform to support make '_execute' return bytes rather     than a string. https://github.com/lxc/pylxd/issues/268 Also switched the base collectors to use /bin/sh as others already did.
2018-01-23tests: when querying ntp server, do not do dns resolution.Scott Moser
Tests run on EC2 would successfully resolve the ipv4 dns address and that caused false positives on failure reports. Basically, dns lookup of 172.16.15.14 would return ip-172-16-15-14.us-east-2.compute.internal. which then shows up in the ntpq output unless you provide -n.
2018-01-09tests: update apt sources list testJoshua Powers
Due to additional platforms getting added this test was not taking into account platform specific mirrors nor was it checking that no additional entries were added.
2017-12-07pylint: Update pylint to 1.7.1, run on tests/ and tools and fix complaints.Ryan Harper
The motivation for this is that a.) 1.7.1 runs with python 3.6 (bionic) b.) we want to run pylint on tests/ and tools for the same reasons that we want to run it on cloudinit/ The changes are described below. - Update tox.ini to invoke pylint v1.7.1. - Modify .pylintrc generated-members ignore mocked object members (m_.*) - Replace "dangerous" params defaulting to {} - Fix up cloud_tests use of platforms - Cast some instance objects to with dict() - Handle python2.7 vs 3+ ConfigParser use of readfp (deprecated) - Update use of assertEqual(<boolean>, value) to assert<Boolean>(value) - replace depricated assertRegexp -> assertRegex - Remove useless test-class calls to super class - Assign class property accessors a result and use it - Fix missing class member in CepkoResultTests - Fix Cheetah test import
2017-11-20integration test: replace curtin test ppa with cloud-init test ppa.Scott Moser
Cloud-init integration tests should not depend on a curtin test ppa. We already had a cloud-init test ppa for explicitly this purpose. Just use it instead.
2017-11-09Replace the temporary i9n.brickies.net with i9n.cloud-init.io.Scott Moser
We had used some dns records in i9n.brickies.net (my personal domain) as a temporary solution until we got names registered in the cloud-init.io namespace. We now have CNAME records for: ubuntu.i9n.cloud-init.io cloudinit1.cloud-init.io cloudinit2.cloud-init.io
2017-11-06tests: integration test cleanup and full pass of nocloud-kvm.Scott Moser
Integration test harness changes: * Enable collection of console log in nocloud-kvm and lxd. * Collect the console log to results for all test runs. * change 'tmpfile' to pick name locally instead of using 'mktemp'. * drop the 'instance' attribute from nocloud-kvm Image and demote LXDImage.instance to a private attribute. This is because Images do not actually have instances. (LXDImage internally uses a booted system to modify the image). * Add 'TargetBase' as a superclass of Image and Instance providing implementations of execute, read_data, write_data, pull_file, and push_file. These all depend on an implementation of _execute. * Improve '_execute' implementations to support accepting stdin. * execute supports 'rcs=False' meaning 'do not raise exception'. * Drop support for pylxd < 2.2. older versions cannot determine exit code of 'execute', which makes them unusable. * make NoCloudKVMInstance._execute run as root via sudo. This required some changes so that 'hostname' could be reverse-looked up in order to avoid sudo taking a long time (~20 seconds). * re-use existing ssh connection in nocloud-kvm. Test changes here: * do not use /tmp, but rather /var/tmp (LP: #1707222) * make keys_to_console assertions more strict. * change user test cases to always add default (ubuntu) user so that nocloud-kvm's execute which operates over ssh can work.
2017-10-20citest: fix remaining warnings raised by integration tests.Scott Moser
There was fallout in a full integration test run from my adding of test_no_warnings_in_log which asserted that there could not be a WARNING found in the /var/log/cloud-init.log This fixes 2 of the cases: * TestCommandOutputSimple had a valid WARNING written, so adjust its test case to allow for that. * TestLxdDir had a valid config in the test but the module would log a WARNING, so fix the module. Also updates lxd unit tests to look for WARN themselves.
2017-10-20citest: show the class actual class name in results.Scott Moser
Tests are currently run by creating a temporary subclass of each class and then executing it (in get_suites). When running the tests suite the output would contain the temporary class name. That was less than useful, and made batch runs almost impossible to identify which test case had an error. This change goes from output of: FAIL: test_no_warnings_in_log \ (tests.cloud_tests.testcases.get_suite.<locals>.tmp) To FAIL: test_no_warnings_in_log \ (tests.cloud_tests.testcases.modules.ntp.TestNtp)
2017-10-20ntp: fix config module schema to allow empty ntp configChad Smith
Fix three things related to the ntp module: 1. Fix invalid cloud-config schema in the integration test which provided empty dicts instead of emptylists for pools and servers 2. Correct logic in the ntp module to allow support for the minimal cloud-config 'ntp:' without raising a RuntimeError. Docs and schema definitions already describe that cloud-config's ntp can be empty. An ntp configuration with neither pools nor servers will be configured with a default set of ntp pools. As such, the ntp module now officially allows the following ntp cloud-configs: - ntp: - ntp: {} - ntp: servers: [] pools: [] 3. Add a simple unit test which validates all cloud-config provided to our integration tests to ensure it adheres to any defined module schema so as more jsonschema definitions are added, we validate our integration test configs. LP: #1724951
2017-10-18schema: Log debug instead of warning when jsonschema is not available.Scott Moser
When operating in expected path, cloud-init should avoid logging with warning. That causes 'WARNING' messages in /var/log/cloud-init.log. By default, warnings also go to the console. Since jsonschema is a optional dependency, and not present on xenial and zesty, cloud-init should not warn there. Also here: * Add a test to integration tests to assert that there are no warnings in /var/log/cloud-init.log. * Update one integration test that did show warning and the related documentation and examples. LP: #1724354
2017-10-03tests: Combine integration configs and testcasesJoshua Powers
Combine the configs and testcases directories, so all files are together in one place. Update the test config location as well.
2017-07-26tests: adjust locale integration test to parse default locale.Scott Moser
The locale integration test started failing with commit 0ef61b28. This was just because the test's expectations on the content/formatting of /etc/default/locale were too strict. The change here is to read the file as a set of shell variables and assert that the values are set correctly.
2017-07-11test: fix incorrect keyid for apt repository.Joshua Powers
The test is currently importing the incorrect keyid. It specifies the curtin developers ppa, rather than the cloud-init ppa. On Artful this causes failures as a check is made to verify the correct key is imported for the ppa, whereas on previous releases only a warning was issued. Also, change to use a full key fingerprint. LP: #1702717
2017-06-27Tests: Simplify the check on ssh-import-idJoshua Powers
I want to be able to add additional SSH keys to my account, therefore I should not be limiting these tests to look for one specific key. Instead we confirm that the comment in authorized_users has the specified users.
2017-06-27tests: update ntp tests after sntp addedJoshua Powers
Recent change to ntp in artful has added the sntp package whenever ntp is installed. The tests, rather poorly, did a dpkg -l instead of checking with `which`. This fixes the ntp tests to all use `which` over expecting a certain number of lines using dpkg and as a result make the tests OS independent.
2017-06-08Integration Testing: tox env, pyxld 2.2.3, and revamp frameworkWesley Wiedenmeier
Massive update to clean up and greatly enhance the integration testing framework developed by Wesley Wiedenmeier. - Updated tox environment to run integration test 'citest' to utilize pylxd 2.2.3 - Add support for distro feature flags - add framework for feature flags to release config with feature groups and overrides allowed in any release conf override level - add support for feature flags in platform and config handling - during collect, skip testcases that require features not supported by the image with a warning message - Enable additional distros (i.e. centos, debian) - Add 'bddeb' command to build a deb from the current working tree cleanly in a container, so deps do not have to be installed on host - Adds a command line option '--preserve-data' that ensures that collected data will be left after tests run. This also allows the directory to store collected data in during the run command to be specified using '--data-dir'. - Updated Read the Docs testing page and doc strings for pep 257 compliance
2017-05-23tests: Apply workaround for snapd bug in test case.Joshua Powers
Snapd does not start on artful or on the versions in proposed. This changes the behavior of the test to confirm that snapd is installed, not that it is started, while the snap team fixes the issue (LP: ##1690880).
2017-05-22function spelling & docstring updateJoshua Powers
2017-05-22Fixing wrong file name regression.Joshua Powers
2017-05-19cc_ntp: write template before installing and add service restartRyan Harper
On systems which installed ntp and specified servers or pools in the config ntpd didn't notice the updated configuration file and didn't use the correct configuration. Resolve this by rendering the template first which allows the package install to use the existing configuration. Additionally add a service restart to handle the case where ntp does not need to be installed but it may not have started. Add an integration test to confirm that cc_ntp enables ntp to use the specific servers and pools in the cloud-config. LP: #1645644
2017-04-12Fix examples that reference upstream chef repository.Jon Grimm
Also add integration test. Note: this new test is not comprehensive; it simply ensures that the example chef configuration does not blow up and that chef seems to be installed after its completion. This new test is disabled by default as it depends on a 3rd party repository. LP: #1678145
2017-03-24Add support for setting hashed passwordsTore S. Lonoy
This change will add support for hashed passwords in cc_set_passwords. It checks if a password is a hash with by checking that it matches in fairly safe way, and also that the password does not have a ":" in it. chpasswd needs to know if the password is hashed or not, so two lists is created so chpasswd is feed with the correct one. LP: #1570325
2017-03-17test: Adding integratiron test for password as listJoshua Powers
This adds an integration test for setting passwords when given as a list rather than a string. This also updates the docs and tests so that Random is now RANDOM as is correct.
2017-03-17Integration Testing: improve testcase subclassingWesley Wiedenmeier
Use inspect.getmro(mod) rather than mod.__bases__ to test if a potential testcase class inherits from CloudTestCase. This allows testcases to be based on CloudTestCase indirectly, adding greater flexibility to the structure of test classes.
2017-03-13test: avoid differences in 'date' output due to daylight savings.Scott Moser
When testing for timezone we were testing that 'date' output would contain 'HDT' for the current time. But after a 'spring forward', the current time started to have 'HST'. Instead of asking 'date' for the timezone that applies now, ask it for a static date.
2016-12-22integration test: initial commit of integration test frameworkWesley Wiedenmeier
The adds in end-to-end testing of cloud-init. The framework utilizes LXD and cloud images as a backend to test user-data passed in. Arbitrary data is then captured from predefined commands specified by the user. After collection, data verification is completed by running a series of Python unit tests against the collected data. Currently only the Ubuntu Trusty, Xenial, Yakkety, and Zesty releases are supported. Test cases for 50% of the modules is complete and available. Additionally a Read the Docs file was created to guide test writing and execution.