Commit Graph

25 Commits

Author SHA1 Message Date
Matthew Thode
9707cf5282
Add testing for the Gentoo element
This commit adds testing for the gentoo element based off of the debian
element.  In adding testing support a couple of additional errors were
found and corrected, namely the following.

* shm is not in /proc/mounts though it is valid for use based off of
  the sticky flag.
* The path in ELEMENTS_PATH needs to be pruned to be usable.
* Added uuidgen-runtime to the list of packages installed for Ubuntu
  as the new ubuntu-trusty image does not ship with it.

Change-Id: I0d2768a912b350e1b2cf40d2fd227fdc767b1bcb
2016-03-17 00:13:32 -05:00
SamYaple
0c32784663 Revert "Zerofree the image if possible"
This reverts commit 5184d02a7c.

The decision was made to go with fstrim because it is faster and more
universal that zerofree. The related-id has the patchset that implements
fstrim.

Related-Id: I269b4416be450369616f9b8e030f84c30e329804
Change-Id: If40cf2fc0ecd8686768cbfeac9ecee90907674e7
2016-03-10 20:38:01 +00:00
Clark Boylan
5184d02a7c Zerofree the image if possible
If the image has an ext filesystem and the zerofree utility is present
on the build system then run zerofree. This should make images as
compressable as possible which is a nice feature when building
compressed qcow2 images.

Change-Id: Ia6062c291f7a3f58b85a4f408ecb3d0574c65d53
2016-03-07 17:45:14 -08:00
Ian Wienand
b18f71f781 Rework functional test runner
This simplifies and enhances the functional-test runner script for
much better interactive behaviour and to give us the ability to better
choose what is running in CI.

Firstly, I have split the image-output testing into a separate script.
This is not actually part of the functional testing of elements and is
both logically and functionally different.  It currently does not run
in upstream CI because we don't have docker in the images.  I have
nothing against it, but it can be it's own thing.

run_functests.sh is overhauled to have a useful interactive interface,
e.g.

---
 $ ./run_functests.sh -h
 run_functests.sh [-h] [-l] <test> <test> ...
   -h : show this help
   -l : list available tests
   <test> : functional test to run
            Special test 'all' will run all tests

 $ ./run_functests.sh -l
 The available functional tests are:

  apt-sources/test-sources
  debian/build-succeeds
  fedora/build-succeeds
  fedora/build-succeeds-f21
  ironic-agent/build-succeeds-fedora
---

As described there, you can run a single test, a number of tests, the
default tests (as CI will do) or all tests.  Running all tests is too
much for regular CI, but currently the only way to stop a low priority
test running, or temporarily pause is to remove it completely --
clearly sub-optimal (see I93c2990472e88ab3e5ff14db56b4ff1b4dd965ef).

There is nothing complicated about this, and to further simplify I
have merged the runner functions back into run_functests.sh which
remains a very modest ~150 lines, with most of that being argument
sanity.  With that and the image-format cleanup, we can remove the
indirection of the 3 small library files.

For consistency, I have renamed the "dib_functions_test" (that tests
things from the dib functions library) with a run_* prefix.

Because the default list is the same as the current functional tests
run, this does not modify the status-quo.  I plan to modify this,
however, to run fedora-minimal & centos-minimal tests in a future
change, as these are required to be stable for openstack ci.

Documentation is updated, and a README.rst is added in the tests
directory for discoverability.

Change-Id: I86d208bd34ff09a29fdb916a4e7ef740c7f65af8
2016-02-19 13:50:09 +11:00
Ian Wienand
f82cfb156a Fix tar listing in functional tests
I noticed when running functional tests via a interactive shell they
would end up hanging; I tracked it down to waiting for input on this
tar command.  We need to specify "-f" so it opens the file ...

---
 | + tar -t /tmp/tmp.qid2Ygfu7v/image.tar
 | + grep -q /tmp/dib-test-should-fail
 | tar: This does not look like a tar archive
 | tar: /tmp/tmp.qid2Ygfu7v/image.tar: Not found in archive
 | tar: Exiting with failure status due to previous errors
---

I guess we never noticed because it's always running in CI where stdin
is closed and it just get that nothing read above.  This probably was
reversing the logic of the "should have failed" tests ... but I don't
think we take that path currently for any tests.

Change-Id: Idad2c172797395d45c0d750ec687011cc1fbf52a
2016-02-04 15:50:25 +11:00
Jenkins
1733c5fb92 Merge "Don't use wc -l for the umount check" 2016-01-29 04:35:28 +00:00
Jenkins
fbd437fea6 Merge "Add inetutils-ping to test-deps" 2016-01-28 10:17:27 +00:00
Steve Kowalik
556535caaa Don't use wc -l for the umount check
We don't need the follow the pattern of checking wc -l against
/proc/mounts is 0, we care about any match, so we can just use
grep and it's exit code inside the if.

Change-Id: Idd0d78a613f8b43f169a320527c763d0bff74368
2016-01-28 19:24:10 +11:00
Ian Wienand
53c57d75c7 Cleanup unmount_dir function
Cleanup this function to work with a symlinked directory.  Document
it's behaviour more exactly, and add a simple unit-test for it (not
run by default, due to doing things like mounting and unmounting
system dirs on a live system, which doesn't seem safe for CI.  But it
is useful for developers ensuring sanity).

Change-Id: I335316019ef948758392b03e91f9869102a472b9
2016-01-28 14:47:43 +11:00
Gregory Haynes
c50e9cf26c Add inetutils-ping to test-deps
We require ping, and (amazingly) some hosts don't have ping - such as
ubuntu-minimal images.

Change-Id: I82b4ce15bffe6b164523a47151c01ef4ad190ab0
2016-01-19 02:04:34 +00:00
Jenkins
af5d3bd0c4 Merge "Make check for image-should-fail quiet" 2016-01-08 01:22:37 +00:00
Jenkins
c8c14edfe3 Merge "Support building ACIs" 2015-12-18 13:53:38 +00:00
Gregory Haynes
0537563c27 Make check for image-should-fail quiet
We perform a check for this file after an image build fails to see if it
was intentional. This outputs a message which looks like the failure is
a result of the check when the file is missing which is very confusing
to users. Lets be more quiet about it.

Change-Id: I9b1f6c7c57021d11b4f91cd3c33846fae692b928
2015-12-17 02:31:41 +00:00
Dmitry Tantsur
0e122e8e35 Add a tox target to run functional tests locally
Now 'tox -efunc' can be invoked to run all functional tests in
the 'venv' tox environment. Also `tox -efunc element-name` can be
used to run function tests for one element (e.g. ironic-agent).

Change-Id: Ia685d1b2a7deef2f8b98876ac09792134dd30f2f
2015-10-23 12:05:23 +02:00
Dmitry Tantsur
c49b733fef Fix tests/test_functions.bash
I am not sure why we didn't hit it before, but
1. The command is 'docker images', not 'docker image'
2. Calling 'docker rmi' requires a check on image presence

Change-Id: I127359043f975a25bb1bfad7469dfe01be67e2d9
2015-10-14 13:41:01 +02:00
Dmitry Tantsur
46dcaaedfc Add functional test for ironic-agent on Fedora
Added support for ramdisk-type elements in tests/test_functions.bash
Elements are distinguished by element-type file in a test element.
Note that ironic-agent ramdisk is built with disk-image-create.

Change-Id: I4759859e7f3c004c2d00e7318729602e6c3c4d95
2015-09-22 14:50:17 +02:00
Gregory Haynes
9e1cef01ec Fix test cleanup trap to cleanup tmpdir
We have a bug where we are overriding the tmpdir cleanup with the docker
image rm cleanup. We should be doing both.

Change-Id: I678c6248c1902095352a454618e3bdb9ed73630a
2015-07-22 03:57:09 -07:00
Gregory Haynes
eb6a260a5a Support building ACIs
App containers are a format used by rocket and are specified at the
following url:
https://github.com/appc/spec/

Change-Id: I8ac24f0194c4bf53dffd6c47e0587bc413101698
2015-07-22 09:30:09 +00:00
Monty Taylor
1187f9d5df Add docker output support
We can already produce tarballs, which is the input format docker import
expects. This makes it trivial to add docker as an output format.

Co-Authored-By: Dan Prince <dprince@redhat.com>

Change-Id: Ib60db3b717d33d4cf3181d70fe0ffbfa86fd5d02
2015-07-19 10:20:39 +00:00
Jenkins
6bf4631cfa Merge "Add debian build test case" 2015-06-17 21:10:23 +00:00
Gregory Haynes
2d6e977b2e Use tar -t instead of -l because centos 6
Centos 6 tar appears to only support unix style tar args. Use tar -t
when we inspect test builds.

Change-Id: I91bf321cf6700d59956779a60f613eddd2856024
2015-05-27 17:58:24 +00:00
Gregory Haynes
9a6cf7ee6f Add debian build test case
Weve had some regressions recently with the changes in the debian
element. Lets tests that we can build debian images.

Change-Id: I048e7a32ecb4088ec1b1e3b1efdf146187b093db
2015-05-19 19:23:53 +00:00
Gregory Haynes
b9b6640fa7 Initial element tests
Adding a test function which allows us to use elements to perform
element-specific tests. In order for this to work sanely, also adding
some configuration to our break system so we can assert on negative
tests.

Also adding a test for apt-sources to verify this code actually works.

Change-Id: I378a74255010eca192f5766b653f8a42404be5ea
2015-05-17 02:07:40 +00:00
Gregory Haynes
152975d258 Add install_test_deps script
This is useful for users and for CI so we do not have to chase infra for
changes when dependency issues arise.

Change-Id: I7c8bdaddfe316ae171b34164f99bc3d568eafd92
2015-05-01 21:33:55 +00:00
Gregory Haynes
8266e14adc Add functional smoke test for disk-image-create
We do not have any testing inside DIB for testing disk-image-create
logic. Lets do some smoke testing for all our supported image formats.

Also adding a run_functests.sh so we can extend this later without editing
the jenkins job.

Change-Id: Ie491e27f00bde54f73af6b47c9696ec04d973b14
2015-04-24 16:37:29 +00:00