Commit graph

23 commits

Author SHA1 Message Date
Tom Gundersen
9f05e0b7c4 test/run: print more helpful output
Make sure we catch expected errors and fail gracefully. Also, make
sure the output id is printed on successufl osbuild run so it can
be introspected from outside the test suite.

Handle the case where osbuild suceeds but does not return an
output_id.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-14 17:23:31 +01:00
Tom Gundersen
8255d6ff9c test/run: fix ssh test
This was broken in a rework. The correct status was printed, but
the test failures were not passed on.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-14 13:08:35 +01:00
Tom Gundersen
9b7ad82773 test/run/ssh: keep trying if the '--wait' switch does not work
When we get an ssh connection, before the image is fully booted,
systemctl is-system-started returnse "starting", treat this as a
failed connection, and keep retrying.

Some distros may not support the wait switch correctly.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-14 13:08:35 +01:00
Tom Gundersen
0d091decb5 test: add provisional multi-arch support
Currently we still only build for x86_64, but now the test suite is
prepared for hooking up other architectures.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
9bedc0c393 test/run: allow filter on distro
This way we can test the distros on their respective CI, as not
all distros can be built in all environment. In particular RHEL
needs to be on a subscribed host.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
34a4f24141 test/run: print a bit more useful info on test-runs
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
8c68018d62 test/run: make relative OSBUILD_TEST_STORE consistent
Make it relative to the directory invoking ./run, rather than passing it along.
2019-12-10 02:47:35 +01:00
Tom Gundersen
3adcac0123 test/run: merge boot and non-boot test handling
We can now select specific cases, but whether or not to check image-info
or boot the image is determined purely by the contents of the json test
case.

We still run the tests as two travis workers just to avoid the timeout,
this should clearly be reworked.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
c090ab3812 test/run: drop support for non-pipeline test cases
We were supporting downloading an image and checking its image info. We don't
want to rely on external resources, and we should not test images made by others.

Drop it.
2019-12-10 02:47:35 +01:00
Tom Gundersen
cc04f92997 test/cases: rename json sections
Rename to fit more closely with their use before we add too many more
of these.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
6c44d231ee test/run/nspawn: name the instances differently
We were failing on name reuse. We should be able to not name these
at all, but nspawn is not happy with that.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
a7203db963 test/run/qemu: support compressed images
Uncompress, strip the extension and pass to qemu as usual.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
404ad2023d test/run: wait on is-system-running
Once we are connected, wait for the command to return a definitive
result, rather than retry.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
ad7c5bc735 test/run: improve output on ssh retry
We expect to have to retry the ssh connection, so let's print something
less scary when that happens.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
4ec7ac1ecd test/cases: start to unify boot tests with other image tests
We now have three top-level maps, that can be combined in any way:

boot-test: information about how to boot the image
compose: information about how to generate the pipeline
pipeline: the pipeline to generate the image
expected: the expected image-info

This creates compose entries for all the boot tests, but the blueprints
are named 'blueprint-draft', as we are not yet verifynig that the pipeline
is correct.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
49387604e4 test/run: pass cloud-init data to qemu
This passes the redhat user with ssh key as an ISO image to our
qemu instances, making sure images relying on cloud-init rather than
hardcoded user credentials can be used in our tests.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
59ab975fea test: use the standard port for sshd
For the qemu tests this makes no difference as we are anyway forwarding
the ports. But the nspawn tests share the same network namespace between
the image and the ssh client running the test without any forwarding. In
order for that to work we had to modify the image to use a non-standard
port.

We don't want this for two reasons: we want to make sure we test our images
unmodified, and also this meant that when we changed our pipeline generation
we were not verifying that the boot test cases were updated accordingly. As
a result they have now drifted.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
79b868d423 test/run: run each test in its own network namespace
This makes sure we can use any port to connect to sshd, without
worrynig about clashes with parallel tests, or an sshd instance
running on the host.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-10 02:47:35 +01:00
Tom Gundersen
0217b4b590 test/run: uncompressed raw images before running image-info
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-01 00:05:17 +01:00
Lars Karlitski
7b54f5cfdc pipeline: support osbuild runners
osbuild has a concept of runners now: scripts that set up a build
environment. Update the osbuild submodule to latest master, change
`Pipeline` to to the new buildroot description format, and use the
`org.osbuild.fedora30` runner from the fedora30 distro.
2019-11-27 02:47:36 +01:00
Martin Sehnoutka
1fac27527b add more local boot test cases
1) additional qemu tests for ami, vmdk, vhd, and openstack image types
2) new type of systemd-nspawn tests for tar, ext4, and parititioned disk
types

the systemd-nspawn tests use loopback network interface directly from
the host so it is necessary to tweak the settings of its SSH server.
This is done in a "script" stage using simple "sed" command.
2019-11-13 21:06:49 +01:00
Martin Sehnoutka
77c2ab0e1c Introduce local boot test case for QCOW2
The tests works by executing osbuild with predefined pipeline. Then the
image boots and the testing script creates SSH connection to the running
VM. If everything goes fine `systemctl is-system-running` is executed
with result `running` and the test case passed.

The JSON definition of the test case contains also a blueprint that
should generate the desired pipeline, but it didn't work for me, so I'm
including it for future use from the golang unit tests.
2019-11-11 15:47:01 +01:00
Lars Karlitski
e7ae3b4c47 test: move image-info tests to test/
These tests (will) test more than just image-info: they'll take a
blueprint, verify that `osbuild-pipeline` generates the correct
pipeline, run osbuild with that pipeline and verify that the resulting
image has the expected image-info output.

This change only includes the latter half (i.e., only moves the already
existing tests).

Also drop python's unittest. It was hard to control output (important
for quickly spotting failures and to make travis happy). This introduces
test/run, which runs all test cases in test/cases or the ones given on
the command line.

When a failure occurs, it prints a diff of the actual and the expected
image info.
2019-10-30 01:25:44 +01:00