Commit Graph

38 Commits

Author SHA1 Message Date
Chris Lumens
9c0af49bd1 Fix more tests.
These were broken due to me rebasing before sending a PR off.  They
should work now.

(cherry picked from commit 4cb15e0a0f)
2018-08-09 16:50:59 -04:00
Chris Lumens
7b977745c7 Add error IDs to things that can go wrong when running a compose.
Note the exception string checking around compose_type.  I didn't really
want to introduce a new exception type just for this, but also didn't
want to duplicate strings.  I'd be open to other suggestions for how to
do this.

(cherry picked from commit b3bb438254)
2018-08-09 16:50:11 -04:00
Chris Lumens
22d75526ef 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:49:48 -04:00
Chris Lumens
36b6444050 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:49:38 -04:00
Brian C. Lane
d72603229e Drop .decode from UTF8_TEST_STRING 2018-08-07 12:12:17 -07:00
Brian C. Lane
991091c287 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 12:12:17 -07:00
Brian C. Lane
8786c9764c 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 12:12:17 -07:00
Brian C. Lane
a2a0477424 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 12:12:17 -07:00
Brian C. Lane
1d6d145854 Update ConfigParser usage for Py3
SafeConfigParser is now just ConfigParser
2018-08-07 12:12:17 -07:00
Brian C. Lane
7fbf71dbf2 Add a test for the pylorax.api.timestamp functions 2018-08-07 12:12:17 -07:00
Brian C. Lane
824c84ae2f Use the first enabled system repo for the test
(cherry picked from commit 3fd5e50c80)
2018-08-07 12:12:17 -07:00
Brian C. Lane
2a04eb88ad 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-07 12:12:17 -07:00
Brian C. Lane
2f76700926 Adjust test_server and test blueprints so they depsolve 2018-07-24 14:53:04 -07:00
Brian C. Lane
6c34a17237 Update rsync version in http-server.toml
(cherry picked from commit b0b97adf75)
2018-07-19 11:01:58 -07:00
Chris Lumens
67b4a6c1eb Support loading groups from the kickstart template files.
(cherry picked from commit 1de67f4f63)
2018-07-19 11:00:46 -07:00
Chris Lumens
22ddaa667e 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 0259f3564d)
2018-07-19 11:00:16 -07:00
Brian C. Lane
3f054d6a3a 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.

(cherry picked from commit d92f2f5b04)
2018-07-13 10:17:08 -07:00
Brian C. Lane
ba8e478eed 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.

(cherry picked from commit 86c4ef5f45)
2018-06-21 16:35:48 -07:00
Brian C. Lane
693dc9a6f6 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.

(cherry picked from commit afa89ea657)
2018-06-04 15:47:38 -07:00
Brian C. Lane
1ab33b6416 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).

(cherry picked from commit dd8e4d9e99)
2018-06-04 15:47:32 -07:00
Brian C. Lane
45f4d3e633 Speed up test_dnfbase.py
Calling get_base_object is no longer needed, this speeds things up by
not unnecessarily downloading metadata.

(cherry picked from commit 666d7f1e03)
2018-06-04 15:47:26 -07:00
Brian C. Lane
d9d73a128b Make sure new sources show up in the source/list output
Also remove an unneeded makedirs from test_server.py

(cherry picked from commit 1034cfd9a7)
2018-06-04 15:47:20 -07:00
Brian C. Lane
f88fbc3fca Update test_server for rawhide
The system repo is 'rawhide' and the 'fedora' and 'updates' repos are
disabled.

(cherry picked from commit 22070dcf42)
2018-06-04 15:47:08 -07:00
Brian C. Lane
8ac04a1521 Add support for user defined package sources API
This lives under /api/v0/projects/source/*

See the documentation for details

(cherry picked from commit 6d677b2207)
2018-06-04 15:47:00 -07:00
Brian C. Lane
1af6040143 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.

(cherry picked from commit 095829171a)
2018-05-21 15:41:45 -07:00
Brian C. Lane
13234166f5 Update atlas blueprint
(cherry picked from commit d406fbdf83)
2018-05-21 15:41:45 -07:00
Brian C. Lane
5443c1cfea 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-17 10:34:35 -07:00
Brian C. Lane
cb7e4e55ba Add user and group creation to blueprint
[[customizations.user]] and [[customizations.group]]
2018-05-17 10:34:34 -07:00
Brian C. Lane
8839182f43 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

[[customizations.sshkey]]
user = root
key = root user key
2018-05-17 10:34:34 -07:00
Brian C. Lane
01645a1faf Update test_server for blueprint and Yum to DNF changes. 2018-05-17 10:34:34 -07:00
Brian C. Lane
8970b6758b 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-17 10:34:34 -07:00
Brian C. Lane
9085840401 Update pylorax.api.projects for DNF usage
And adjust tests to match.
2018-05-17 10:34:34 -07:00
Brian C. Lane
e1be281fbb Update dnfbase (formerly yumbase) for DNF support
And adjust tests to match.
2018-05-17 10:34:34 -07:00
Brian C. Lane
96a82b07d9 Update dnfbase tests 2018-05-17 10:34:34 -07:00
Brian C. Lane
9bf93d7154 Use 2to3 to convert the python2 lorax-composer code to python3 2018-05-17 10:34:34 -07:00
Brian C. Lane
b4096ccb62 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-17 10:34:34 -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