Commit graph

129 commits

Author SHA1 Message Date
Christian Kellner
c2d73b431a test/builder: check config parsing
Check that options defined in the config file will be reflected
in the plugin. test all known options.
2020-09-17 10:48:37 +02:00
Christian Kellner
78cef84f67 test/builder: check repo configuration
In the test_compose_success check, after the build is "done",
check the repositories in compose request match with what
we expect.
2020-09-17 10:48:37 +02:00
Christian Kellner
41ee1f1708 test/integration: build image for current distro
Add a separate unit test to do a compose for a RHEL based image,
but then restrict the execution of test_compose_{disto} to the
distribution the test is running on, since currently cross-
distribution builds can be problematic.
2020-09-17 10:48:37 +02:00
Christian Kellner
565cecc07f test/integration: wait for compose result
In the "test_compose" integration test, explicitly wait for the
compose result, instead of being ok with having created the
request for it.
2020-09-17 10:48:37 +02:00
Christian Kellner
cf56696d90 test/builder: check stand-alone usage
Check the basic usage of the plugin as a stand-alone client for
the osbuild-composer API.
2020-09-17 10:48:37 +02:00
Christian Kellner
a660b39e00 test/integration: use copy-cred.sh
Instead of manually copying credentials around, use the new
copy-creds.sh script. Also don't manually initialize kerberos,
because that is now done automatically by the worker and the
builder.
2020-09-17 10:48:37 +02:00
Christian Kellner
c782f7f350 test/integration: make composer certificates
Use test/make-certs.sh to generate osbuild composer ssl/tls certs.
2020-09-17 10:48:37 +02:00
Christian Kellner
2fed0b7c5b test: add copy-creds.sh to copy credentials
This script is intended to be called between "run-koji-container"
and "run-builder". It will copy the kerberos keytabs out of the
temporary directory generated by "run-koji-container" as well as
copying the SSL/TLS certificates from host to the share dir so
that the plugin ca use it to authenticate itself to composer.
2020-09-17 10:48:37 +02:00
Christian Kellner
481243e628 test: add make-certs script to generate SSL certs
This will create the a certificate authority (CA) and then create
a cert for composer and another one for the worker. The worker
one can also be used by the koji plugin.
The configuration file is needed to get subjectAltName working.
2020-09-17 10:48:37 +02:00
Christian Kellner
6b4632385a test/hub: validate the jsonschema
Validate the json schema used to validate the input arguments. So
much validation!
2020-09-17 10:48:37 +02:00
Christian Kellner
2f5bea53f0 test: move kerberos cfg for LOCAL to test/data
This is a test specific configuration file that should not be at
the top level directory. Move it to a new test/data directory.
2020-09-17 10:48:37 +02:00
Christian Kellner
9a21c00f81 test/builder: use composer url from the plugin
Use the new DEFAULT_COMPOSER_URL constant from the plugin. This
will follow changes to e.g. SSL automatically now.
2020-09-17 10:48:37 +02:00
Christian Kellner
e1edb12d11 test/builder: check a successful compose
Use the standard session and options mock object together with the
new composer mock object to simulate a successful compose:
the mock composer will accept the request and also status calls
for it, which will immediately return with success. The plugin
should then return and indicate a successful compose.
2020-09-15 18:59:03 +02:00
Christian Kellner
31885efab8 test/builder: mock composer, check a bad request
Use httpretty to mock composer responses. Create a helper method
to configure a session object that should result in a valid
compose request. Simulate a bad request by asking for an arch
that the mock composer will refuse and check the correct exception
is thrown in the builder plugin.
2020-09-15 18:59:03 +02:00
Christian Kellner
94d0a5f57a test: add httpretty & requests to test container
Add the requests and httpretty packages to the test environment.
The former will be used in the builder plugin and the latter for
mocking http requests.
2020-09-15 18:07:25 +02:00
Christian Kellner
0efe8941c6 test/cli: check a normal invocation
Check a normal, i.e. successful, invocation and ensure relevant
functions are called with the right parameters.
2020-09-14 17:37:35 +02:00
Christian Kellner
0af2d958e3 test: add pytest to test env container
Add pytest and coverage support for it to the koji test environment
container.
2020-09-14 17:02:39 +02:00
Christian Kellner
b92e19aa1d test/cli: add unit test skeleton
Add the skeleton to run the cli plugin unit tests. As first check
ensure that exceptions are thrown for the build target checks.
2020-09-14 13:06:52 +01:00
Christian Kellner
9e98f10afc test/unit: extract common code
Create a new plugintest.PluginTest class that shares the plugin
loading code that is common to all plugin testing. Adapt the
existing (hub, builder) tests.
Also correct the name for test_builder.TestHubPlugin to
TestBuilderPlugin.
2020-09-14 13:06:52 +01:00
Christian Kellner
d8107f2347 test/builder: add unit test skeleton
Add the skeleton to run builder plugin unit tests and check that
exceptions are throw for unknown build target and unsupported
architectures.
2020-09-14 10:00:56 +02:00
Christian Kellner
7568437437 test/hub: simple input validation check
Check that an exception of `koji.ParameterError` gets raised for
invalid input.
2020-09-13 13:20:19 +02:00
Christian Kellner
272d7591ef test: add koji hub plugin unit test skeleton
Load the module, mock session and kojihub, check basic calling
osbuildImage will result in `kojihub.make_task` with the right
parameters.
2020-09-13 13:20:19 +02:00
Christian Kellner
734d039089 test: add github test environment action
Create a github action that accepts any command with args and runs
it in a container that is prepared with all the dependencies for
koji (hub, builder, command line), so all tests, like pylint or
unit tests can run in it.
2020-09-12 16:00:54 +02:00
Christian Kellner
0180bce383 test: use python based integration test
Instead of creating a compose from integration.sh, use the new
python based integration tests. The integration.sh script will
this just setup the environment and the actual tests are all
found in test/integration/
2020-09-11 23:18:04 +01:00
Christian Kellner
6fbdcf505f test: add unknown tag check test
Test that we fail a compose for an unknown tag.
2020-09-11 23:18:04 +01:00
Christian Kellner
3908e5f568 test: add python based compose test 2020-09-11 23:18:04 +01:00
Christian Kellner
d5a80cf3cf test: manually install container-selinux
Seems to not be pulled in. Don't disable selinux.
2020-09-10 20:12:39 +01:00
Christian Kellner
b292458771 test: create a compose via koji
Try testing a compose via the koji, which involves creating using
the koji command line plugin to make the XMLRPC call to koji hub,
where the osbuild koji hub plugin verifies the parameters and then
creates the task. The osbuild koji plugin for the builder is then
picking up the task, and uses composer's koji API to request a
compose. Once this is successful it will be imported by composer
into koji via the 'CGImport' method.
The `koji osbuild-image` command waits for all this and reports
whether the task was successful or not via its exit code (and
on stdout).

This uses a fleet of containers: a database one, a kerberos kdc
one, another one for the koju hub and finally one for the koji
builder. The pre-build RPMs are used to install the plugins.

NB: On RHEL we need to manually install the `dnsname` podman
plugin, since it is missing, but required so that containers
can address each other by hostnames.
See [schutzbot/vendor/README.md](schutzbot/vendor/README.md)
2020-09-10 18:41:13 +01:00
Tom Gundersen
a416570ea2 schutzbot: add CI integration
The CI is in two stages, for each supported distro.

First the RPMs are generated from the spec file in the repo for the
given distro and architecture.

Once all the RPM builds have succeeded successfully, a test machine is
provisioned with osbulid-composer installed, and koji API enabled.

The repository containing the RPMs of the code being tested is also
enabled on the test machine, and the cli client is installed.

Finally, the test/integration.sh script is executed, which currently
does nothing.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-09-10 00:05:44 +02:00