Commit graph

13 commits

Author SHA1 Message Date
Ondřej Budai
7dd09443cf tests/image/ami: test ami images on AWS
Prior this commit the ami images were tested locally using qemu. This does
not reflect at all how they're used in practice. This commit introduces
the support for running them in the actual AWS. Yay!

The structure of code reflects that we want to switch to osbuild-composer
to build the images soon.
2020-04-06 16:38:28 +02:00
Ondřej Budai
92e69dcb85 tests/image: extract one test method for each boot type
Shorter functions are always nicer, right? Also, the AWS and Azure tests will
be longer, this change prepares for that.
2020-04-06 16:38:28 +02:00
Ondřej Budai
00f903b879 tests/image: refactor constants
It's not very clear that the constants are indeed constants. This commit moves
them to a new struct. This way it should be more clear that those values are
constants.
2020-04-06 16:38:28 +02:00
Ondřej Budai
640a9fcd92 tests/image: pass the ssh key from boot types
Soon, images will be run non-locally (AWS, Azure). For the remote ones it's
potentially dangerous to use the publicly available key-pair. This change
prepares the codebase for specifying different keys than the pre-generated
one.
2020-04-06 16:38:28 +02:00
Ondřej Budai
ca3c469bdc tests/image: move the namespace creation closer to the boot types
Soon, images will be run non-locally (AWS, Azure). For those boot types
there's no need to have an unshared network namespace. This commit prepares
the code for that.
2020-04-06 16:38:28 +02:00
Ondřej Budai
cd51cfdcdf tests/image: allow to specify host address
Soon, images will be run non-locally (AWS, Azure). This commit adds support
to test ssh for different machines than those on localhost.
2020-04-06 16:38:28 +02:00
Ondřej Budai
7baacda6ef tests/image: allow to run ssh without network namespace
Soon, images will be run non-locally (AWS, Azure). For this, we cannot
use ssh in a namespaced environment. This commit makes the namespace for ssh
optional.
2020-04-06 16:38:28 +02:00
Ondřej Budai
e593bceede tests/image: use NoError when asserting errors
This is not a functional change (except for the slightly different output).
NoError() is more understandable (both in the code and in the output) than
Nil() when asserting errors. Also the rest of the tests uses mostly NoError()
when asserting errors, this change should lead to a better consistency.
2020-04-06 16:38:28 +02:00
Ondřej Budai
e6f323e6b6 tests/image: format osbuild output in case of a failure
testify library cannot deal with error messages with length > 64k. Sadly,
osbuild output is very long one line. This commits formats the output before
making the error from it.
2020-04-06 16:38:28 +02:00
Ondřej Budai
7c1de17300 tests/image: use %#v when printing errors
When using %#v instead of %v, printing an error gives a slightly more
informative error message, therefore this commit switches to %#v in all
error prints.
2020-03-19 14:25:08 +01:00
Ondřej Budai
1b49755a7e tests/image: remove all distro restrictions
The distro argument and restrictions to run only tests for the same distro
as the host's one were confusing. This commit removes them. Now the behaviour
is following:

By default all the test cases in test case directory are run.
If test cases are given by arguments, they are all run, and test case
directory is ignored.
2020-03-19 14:25:08 +01:00
Ondřej Budai
3cb2a5f930 tests/image: remove the hack for fedora-30
Previously we had only tests for Fedora 30, therefore I added a hack to treat
every Fedora as Fedora 30, so the tests would run. Now, we have tests for
multiple Fedora versions, therefore the hack is no longer needed.
2020-03-19 14:25:08 +01:00
Ondřej Budai
acfb461aa5 tests/image: switch the implementation to go testing framework
We're currently rewriting all the integration tests to use the Go
testing framework. This commit does the switch for the image tests.

I decided not to use the testing framework in functions which are
not directly tight to testing (booting images, running osbuild). I think
it's reasonable to use classic error handling there and propagate the errors
to places directly tight to testing and use the testing library.
This enables us to reuse the code in different part of projects if needed.
2020-03-19 14:25:08 +01:00
Renamed from cmd/osbuild-image-tests/main.go (Browse further)