Commit Graph

350 Commits

Author SHA1 Message Date
Chris Lumens 2f8f076b1f Add error IDs for when an unknown blueprint is requested.
This adds some fairly redundant code to the beginning of all the
blueprint routes to attempt reading a commit from git for the
blueprint's recipe.  If it succeeds, the blueprint exists and the route
can continue.  Otherwise, return an error.  Hopefully this doesn't slow
things down too much.

(cherry picked from commit a925cc7ddb)
2018-08-09 16:18:49 -04:00
Chris Lumens a2ce0686ca Add error IDs for when an unknown build UUID is requested.
Note that this also changes the return type of uuid_info to return None
when an unknown ID is given.  The other uuid_* functions are fine
because they are checked ahead of time.

(cherry picked from commit 6497b4fb65)
2018-08-09 16:18:40 -04:00
Brian C. Lane 55dd45de6e Drop .decode from UTF8_TEST_STRING 2018-08-07 10:12:14 -07:00
Brian C. Lane ec4c555174 Add input string checks to the branch and format arguments
Make sure no UTF8 characters are allowed and return an error if they
are.

Also includes tests to make sure the correct error is returned.

(cherry picked from commit 86d79cd8a6)
2018-08-07 10:12:02 -07:00
Brian C. Lane f93f64a061 Add a test for invalid characters in the API route
Currently the code is not UTF8 safe, so we need to return a clear error
when invalid characters are passed in.

This also adds tests for the routes to confirm that an error is
correctly returned.

(cherry picked from commit 74f5def3d4)
2018-08-07 10:12:02 -07:00
Brian C. Lane e2dd59c6dc Update get_system_repo for dnf
With dnf we iterate the repos and return their names, not the filenames
like we do with yum. Also make the list test more flexible.
2018-08-07 09:22:18 -07:00
Brian C. Lane 991416adf5 Update ConfigParser usage for Py3
SafeConfigParser is now just ConfigParser
2018-08-07 09:22:18 -07:00
Brian C. Lane fc9a469ca2 Update StringIO use for Py3
It is imported from io now.
2018-08-07 09:22:18 -07:00
Brian C. Lane 7379102923 Add a test for the pylorax.api.timestamp functions 2018-08-07 09:22:18 -07:00
Brian C. Lane ae19bc7343 Use the first enabled system repo for the test
(cherry picked from commit 3fd5e50c80)
2018-08-06 16:56:49 -07:00
Brian C. Lane aec0e09caa Show more details when the system repo delete test fails
Works fine for me locally, but not in Travis for some reason so let's
get more info.

(cherry picked from commit 26df083bd4)
2018-08-06 16:56:03 -07:00
Brian C. Lane 18b03936c2 Add composer-cli function tests
These depend on there being a freshly installed lorax-composer API
server running, if there is no /run/weldr/api.socket they will be
skipped.

(cherry picked from commit 7700ae3135)
2018-08-06 16:53:56 -07:00
Brian C. Lane 2ce3752f90 Add a test library
This adds empty __init__.py to tests so that a lib.py library of helper
functions can be imported from the tests.

Add captured_output to use with composer-cli tests to capture stdout/err
output from the functions.

(cherry picked from commit eeae331ba0)
2018-08-06 16:53:48 -07:00
Brian C. Lane 08c2965fab Modify handle_api_result so it can be used in more places
Some results have errors and no status, others have status and errors.
Update the function to return the final rc to exit with, and a bool
indicating whether or not to continue processing the other fields.

Add a bunch of tests for the new function to make sure I have the logic
correct.

(cherry picked from commit 35fa067219)
2018-08-06 16:52:28 -07:00
Brian C. Lane 231a8ed4b2 Update samba and rsync versions for tests 2018-07-18 15:58:48 -07:00
Chris Lumens e151c8399d Add group-based tests.
(cherry picked from commit ab0655d5a9)
2018-07-18 15:38:40 -07:00
Chris Lumens 8c4804eb15 Include groups in depsolving.
This adds a new argument to projects_depsolve and
projects_depsolve_with_size that contains the group list, unfortunately.
I would have prefered adding a function that just returns a list of all
the contents of a group and then add that to what was being passed into
projects_depsolve.  However, there does not appear to be any good way to
do that in yum aside from a lot of grubbing around in the comps object,
which I am unwilling to do.

(cherry picked from commit 5fe4b47072)
2018-07-18 14:36:28 -07:00
Chris Lumens 76d376fe18 Add support for groups to blueprints.
Nothing is currently being done with this information, but it will be
soon.

(cherry picked from commit 0f69d2084c)
2018-07-18 13:48:25 -07:00
Brian C. Lane 460a277d4e Check the compose templates at startup
Depsolve the packages included in the templates and report any errors
using the /api/status 'msgs' field. This should help narrow down
problems with package sources not being setup correctly.
2018-07-13 10:18:07 -07:00
Sophia Fondell 378099cc10 Fixing bug where test did not try to import pylorax.version to check for version but automatically just checked for 'devel' causing test to fail when it should not have 2018-06-22 09:14:04 -07:00
Brian C. Lane 86c4ef5f45 Allow more than 1 bash build in tests
It is perfectly valid to have more than one build of a package, eg. one
in the release repo and one in the updates repo.
2018-06-21 16:09:47 -07:00
Brian C. Lane 59847db275 Update tests for glusterfs 4.1.* on rawhide 2018-06-21 15:43:17 -07:00
Brian C. Lane afa89ea657 Fix DNF related issues with source selection
DNF Repo.dump() function cannot be used as a .repo file for dnf due to
it writing baseurl and gpgkey as a list instead of a string. Add a new
function to write this in the correct format, and limited to the fields
we use.

Add a test for the new function.

Fix /projects/source/info to return an error 400 if a nonexistant TOML
source is requested. If JSON is used the error is part of the standard
response.

Update test_server.py to check for the correct error code.
2018-06-04 15:45:36 -07:00
Brian C. Lane dd8e4d9e99 Fix handling bad source repos and add a test
When adding a source failed it wasn't being removed from the dnf object.
This fixes that, and returns an error when setting up the source fails.
Also adds a test for it.
This also includes detecting rawhide vs. non-rawhide releases and
adjusting the tests accordingly (some of the source names change).
2018-06-04 15:45:36 -07:00
Brian C. Lane 666d7f1e03 Speed up test_dnfbase.py
Calling get_base_object is no longer needed, this speeds things up by
not unnecessarily downloading metadata.
2018-06-04 15:45:36 -07:00
Brian C. Lane 1034cfd9a7 Make sure new sources show up in the source/list output
Also remove an unneeded makedirs from test_server.py
2018-06-04 15:45:36 -07:00
Brian C. Lane 22070dcf42 Update test_server for rawhide
The system repo is 'rawhide' and the 'fedora' and 'updates' repos are
disabled.
2018-06-04 15:45:36 -07:00
Brian C. Lane 6d677b2207 Add support for user defined package sources API
This lives under /api/v0/projects/source/*

See the documentation for details
2018-06-04 15:45:36 -07:00
Brian C. Lane 095829171a Add support for version globs to blueprints
This uses dnf's version__glob filter to implement it. It amounts to '*'
wildcards and '?' for single character matching.
2018-05-18 12:03:26 -07:00
Brian C. Lane d406fbdf83 Update atlas blueprint 2018-05-18 11:26:04 -07:00
Brian C. Lane a363aee971 Skip creating groups with the same name as a user
Otherwise the user creation fails when anaconda sees there is already a
group with that name. Log a warning and continue on.
2018-05-14 13:00:15 -07:00
Brian C. Lane 07ea61be77 Add user and group creation to blueprint
[[customize.user]] and [[customize.group]]
2018-05-14 13:00:15 -07:00
Brian C. Lane 25bec0b50d Add blueprint customization support for hostname and ssh key
This adds support for the optional blueprint section [customizations].

Use it like this:

[customizations]
hostname = yourhostnamehere

[[customiations.sshkey]]
user = root
key = root user key
2018-05-14 13:00:15 -07:00
Brian C. Lane 825d1931e4 Add composer-cli and tests 2018-05-14 13:00:15 -07:00
Brian C. Lane 5c25f98db7 Update test_server for blueprint and Yum to DNF changes. 2018-05-14 13:00:15 -07:00
Brian C. Lane 0a3e6598b2 Update the test blueprints
Change versions to match Fedora versions. Add version numbers to the
blueprints except for glusterfs.toml, not having a version is used as
part of the tests.
2018-05-14 13:00:15 -07:00
Brian C. Lane 733c824c49 Ignore more pylint errors 2018-05-14 13:00:15 -07:00
Brian C. Lane 9b9b627fe5 Update pylorax.api.projects for DNF usage
And adjust tests to match.
2018-05-14 13:00:14 -07:00
Brian C. Lane e86f4f9a36 Update dnfbase (formerly yumbase) for DNF support
And adjust tests to match.
2018-05-14 13:00:14 -07:00
Brian C. Lane 454c74035c Update dnfbase tests 2018-05-14 13:00:14 -07:00
Brian C. Lane d31bea7bd3 Use 2to3 to convert the python2 lorax-composer code to python3 2018-05-14 13:00:14 -07:00
Brian C. Lane 4a91936dd2 Add the tests from lorax-composer branch
These currently fail for several reasons and will be adjusted as the
code it ported to this branch.
2018-05-14 13:00:14 -07:00
Brian C. Lane dc635a97f6 Write the --variant string to .buildstamp as 'Variant=' 2018-01-17 09:38:16 -08:00
Alexander Todorov fe461f480e Add first unit test so we can start collecting coverage 2017-10-13 18:58:17 +03:00
Alexander Todorov 6bf8187e3e Update false positives
- remove unused ones
- add a new one
2017-10-09 13:38:56 -07:00
David Shea 1eb1396d48 Remove the removal of the eintr checker, which has been removed 2016-02-04 11:30:18 -05:00
Brian C. Lane a3097b3085 Update things to make pylint 1.5.1 happy 2015-12-16 12:59:48 -08:00
Brian C. Lane 1a92b1b05e Convert to using pocketlint for pylint rules
Also cleanup some warnings.
2015-05-15 17:11:20 -07:00
Brian C. Lane de0e662f51 Convert pylorax to python3
Fix up 2to3 complaints. I've decided to do with wrapping list
comprehension inside list() to get the generators to run in several
places instead of list(map( or list(filter( which seem less readable to
me.
2015-05-15 17:11:20 -07:00
Brian C. Lane c12c5f1e47 Add pylint testing
This adds pylint testing via make check, using the framework from
Anaconda. False positives can be added to
./tests/pylint/pylint-false-positives
2014-05-09 08:10:41 -07:00