History | View | Annotate | Download (6.3 kB)
unit tests: Add tests for uid and gid handling in utils.WriteFile
These tests need fakeroot. If it's not present, they are not run (theydon't fail).
Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Fix unittest breakage on Python 2.4/2.5
Commit 70b0d2a29 broke unittests on Python 2.4 and 2.5. Turns out thatPython 2.6 and above allow classes to be passed as custom test runners,whereas earlier versions don't.
Signed-off-by: Michael Hanselmann <hansmi@google.com>...
Always enable logging for unittests
By enabling all log levels, we ensure all calls are fully evaluated.There was one case in the workerpool where a call to “logging.debug”was wrong, but not caught in unittests because debug logging wasdisabled.
The optional environment variable “LOGTOSTDERR” can be set to...
Ensure assertions are evaluated in tests
A lot of assertions are used in Ganeti's code. Some unittests even checkwhether AssertionError is raised in some cases. Explicitely ensuringassertions are evaluated makes sure those tests don't fail andassertions are checked....
testutils: Print name of test program before running it
While the name can be looked up in Makefile.am, thisis useful when an automated test just hangs and needsto be killed.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Ignore log messages in unittests
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Iustin Pop <iustin@google.com>
Fix serializer unittests
Commit d22b29997cd broke the serializer unittests with certainversions of simplejson. This patch removes sort_keys againand implements a slightly more efficient way of detectingsimplejson functionality. The serializer unittests no longer...
Add simple unittest for hooks documentation
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Luca Bigliardi <shammash@google.com>
Run unittests in a temporary directory
Apply the right permissions to /etc/hosts
In the current Ganeti version when modifying /etc/hosts we mistakenlygive it the permissions of the temporary file we create to define itscontent, which is by default 0600. This breaks most non-rootapplications, and thus must be corrected. This patch forces the mode to...
Unify some unittest functions
This patch adds unified temporary file handling to thetestutils.GanetiTestCase class, which adds easy creation and automatedcleanup of temporary files.
The patch allows a simpler handling in a couple of test cases butrequires all child classes to call the parent setUp and tearDown...
Generalize the reading of test file data
Currently we have two methods in ganeti.bdev_unittest.py of computingthe test data file name - and, of course, they don't give the sameresults.
The patch moves the functions to compute the test file name and reading...
Split GanetiUnitTest into testutils.py
Reviewed-by: iustinp