Commit Graph

102 Commits

Author SHA1 Message Date
Cole Robinson
79da19ad07 Fix some pylint, exclude some new warnings
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-10-04 16:04:33 -04:00
Cole Robinson
af63df9793 tests: Fix test_urls after pytest conversion
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-30 16:55:13 -04:00
Cole Robinson
fa322588b4 tests: Drop most unittest usage from virtinst tests
Kill usage of the TestCase class, move more to pytest standard
style

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-19 13:46:46 -04:00
Cole Robinson
71ac3ee044 tests: Convert to use pytest style 'assert'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-19 13:44:50 -04:00
Cole Robinson
61a947d667 tests: Rename clistate -> TESTCONFIG
Makes it more clear it's a constant class, and its purpose

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:38:40 -04:00
Cole Robinson
78c8aef75e tests: Move all data directories to data/
This cleans up the file hierarchy a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
5d8bd316c1 tests: test_urls: Reset cached guest os_variant before short circuit test
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 16:16:55 -05:00
Cole Robinson
0df8577e11 test_urls: dont try ftp:// with --force-libosinfo 2019-07-16 16:53:14 -04:00
Cole Robinson
2c49c3887c tests: test_urls: Better error report overwriting 2019-06-24 19:39:07 -04:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
54a28485df tests: Use assertRaises more 2019-06-14 13:04:56 -04:00
Cole Robinson
4dd12e2e56 installer: Generate the unattended script only in installer
And pass it down to treemedia, which acts on our script wrapper
object. This is conceptually a bit simpler because we can see in
one place what data feeds the script build process, depending on
installer props
2019-06-09 20:19:42 -04:00
Cole Robinson
37adfb0150 urlfetcher: Add http and ftp unit test mocking 2019-06-07 21:25:41 -04:00
Cole Robinson
c603ea4084 util: Move *_meter to progress.py 2019-06-07 17:32:51 -04:00
Cole Robinson
bc4573a14b Fix codespell errors 2019-05-16 14:43:31 -04:00
Cole Robinson
3be238b03e tests: test_urls: Add --*libosinfo, --iso-only, --url-only
These are options that will help tweak the test_urls logic,
to help as we try to ensure libosinfo covers all the cases
we care about.
2019-03-24 12:32:03 -04:00
Cole Robinson
be15a01bb2 tests: test_urls: require explicit distro= value
Most tests have a distro= value specified already. Make distro=none
required for those tests since they are limited
2019-03-02 16:52:24 -05:00
Cole Robinson
41b276ffcd installertreemedia: Don't carry around _Distro internally
Detect the distro, and pull out all the data we need into an internal
cache. This will simplify future improvements
2019-02-03 12:05:18 -05:00
Cole Robinson
bcb13bfbfa tests: test_urls: Add some additional failure cases 2019-02-03 12:05:18 -05:00
Cole Robinson
f7619cdcda tests: test_urls: Use installer, not _Distro directly 2019-02-03 12:05:18 -05:00
Cole Robinson
5df6bc2ba5 test_urls: Drop comparison against _Distro class
Future changes to use libosinfo more are going to break
this. Comparing against detected os_variant should be
mostly sufficient
2019-02-03 12:05:18 -05:00
Cole Robinson
9e4287321f urlfetcher: Drop explicit prepare/cleanup calls
We can do this automatically easily enough. The downsides of
not cleaning up are pretty minor these days anyways without
the 'mount' handling
2019-02-03 12:05:18 -05:00
Cole Robinson
9995ebc86b urldetect: Kill acquireKernel
Decompose it into a helper to probe for available kernel paths, but leave
the actual file fetching up to the installer class
2019-02-03 12:05:18 -05:00
Cole Robinson
c38be50dcb urldetect: Use fedora-unknown more
Instead of the magic to look up latest OS... fedora-unknown is meant
for that usecase.
2019-01-08 16:02:34 -05:00
Marc Hartmayer
6476a6a489 test_urls: simplify the sorting
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-01-07 14:46:00 -05:00
Fabiano Fidêncio
7612c5bdcd osdict: expand the "unknown" check for any distro
Currently osinfo-db has "unknown" entries for fedora, opensuse and
asianux. Considering this list may grow even more at some point, let's
just make the check more generic and use it for all of them instead of
keeping it for fedora only.

Changes have also been done in urldetect and tests_url, as those also
used latest_fedora_version().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Cole Robinson
49f469a034 test_urls: Always check for distro value 2018-10-18 13:43:12 -04:00
Cole Robinson
cd122b9387 test_urls: Drop dead code
This is solved by the "testsuite-fedora-rawhide" hack
2018-10-18 13:36:16 -04:00
Cole Robinson
fe9aa7085b test_urls: Add kernelregex= option
For verifying detected kernel paths. Add a few basic examples. I
will use this in my local iso test suite for checking debian
iso vs http-iso case
2018-10-18 13:21:44 -04:00
Cole Robinson
8ff2043f2a urldetect: Drop boot.iso fetching
Since this was only used for the --cdrom $treeurl case, this is
no longer used
2018-10-12 15:54:39 -04:00
Cole Robinson
6063538750 guest: Replace os_variant with set_os_name
And have callers directly access osinfo.name if they need it
2018-09-12 17:24:28 -04:00
Cole Robinson
568841835d urldetect: Standardize _detect_version naming
This is the hook that subclasses use to save a detect os_variant value
2018-04-24 11:34:53 -04:00
Cole Robinson
a9ad2426b0 test_urls: Improve error output 2018-04-24 11:33:12 -04:00
Cole Robinson
105a6d20be tests: urls: Fix custom ini file usage 2018-04-16 11:36:39 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
83a1c43490 tests: test_urls: Look for manual.ini in ~/.config/virt-manager
Rather than deal with ignoring it in the source tree
2018-04-03 15:29:03 -04:00
Cole Robinson
eafdaf8b48 tests: test_urls: Add urldetect kernel arg validation 2018-04-02 17:15:05 -04:00
Cole Robinson
ad13c57dc5 urlfetch: Formalize the failed hostname check
This heuristic is only valid for http connections, everything
else will fail way earlier in the process
2018-03-29 19:45:33 -04:00
Cole Robinson
5055d7bd19 urlfetcher: Clean up RHEL version parsing/handling
Drop SLDistro entirely because it adds nothing, just make it an
alias of Centos. Drop some old RHEL version logic. Tweak test cases
2018-03-29 19:45:33 -04:00
Cole Robinson
b9e72b8609 urldetect: Move treeinfo media checking into Treeinfo class
Rather than in the base Distro class. Simplifies things a bit
2018-03-29 16:23:57 -04:00
Cole Robinson
5aedc0aff7 urldetect: Drop GenericDistro, non-treeinfo redhat bits
non-treeinfo redhat only applies to pre RHEL5.4 and very old
Fedora. It's not worth it anymore to slow down all URL lookups
and maintain code complexity to handle such long out of date
distros.

GenericDistro doesn't actually apply to any public trees that I
can find, except for some with TreeInfo. So turn it into
GenericTreeinfoDistro. If random URL trees want to work with
virt-install, add a treeinfo file
2018-03-29 16:23:57 -04:00
Cole Robinson
a8522032eb virtinst: Split out urldetect.py from urlfetcher.py
urldetect.py has all the distro metadata and parsing logic,
urlfetcher.py has the http/ftp/iso/etc. fetching logic
2018-03-28 18:46:07 -04:00
Cole Robinson
35df66c1ed tests: test_urls: Make fedora distro checking a bit smarter
Rather than constantly require updating distro values for latest
Fedora when osinfo-db catches up, build some smarts into the
test suite
2018-03-28 14:56:52 -04:00
Cole Robinson
74f2fb73fd tests: test_urls: Rename distroobj->testdata
Makes it much more clear what it is
2018-03-28 14:40:41 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
6954c6774a tests: Fix running testsuite on older libvirt
If we try to run the testsuite on anything older than libvirt 3.1,
it immediately throws an exception before processing any tests,
due to choking on parsing drm bits from testdriver.xml. This global
failure is only due to sloppy coding though.

Turn all test cases that use testdriver.xml into skips in this case,
so we can at least get some test coverage otherwise.
2018-02-22 16:01:24 -05:00
Cole Robinson
c05cd52772 setup: Use CLIState for setting --debug value 2018-02-22 15:18:47 -05:00
Cole Robinson
8917305a6e Don't use count() for substring checking
Use the idiomatic 'X in Y'
2018-02-14 11:08:09 -05:00
Radostin Stoyanov
978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
810ee09292 Replace ConfigParser with configparser
The ConfigParser module has been renamed to configparser in
Python 3. [1] Backport of this changes is also available for
Python 2. [2]

[1] https://docs.python.org/2/library/configparser.html
[2] https://pypi.python.org/pypi/configparser/3.2.0r3
2018-02-06 18:49:17 -05:00