[Freeipa-devel] [PATCH] 0003 Test generated passwords composed of all allowed charactes

Petr Viktorin pviktori at redhat.com
Fri Jul 18 11:12:33 UTC 2014


On 07/18/2014 12:39 PM, David Kupka wrote:
> Test verifying that IPA server is able to install using passwords
> composed of all but forbidden characters.
>
> Related to https://fedorahosted.org/freeipa/ticket/2796

This doesn't work with current master. When you send patches that depend 
on each other, either send them in a single mail, or explicitly say what 
the dependencies are.


When an exception is raised, you're only logging a message and hiding 
the error. So not only is the traceback lost, but the test always passes!

The proper way to do this is:
     try:
         tasks.install_master(self.master)
     finally:
         tasks.uninstall_master(self.master)
Any other cleanup task, like restoring passwords in the config, should 
also be in its finally: block.

Currently all our tests are (or try to be :) deterministic; I rely on 
the fact that re-running the tests reproduces the results.
Instead of randomness, just use some well-crafted static passwords. You 
can also test e.g. shorter passwords or ones with longer runs of 
whitespace -- there's not much variety in what you generate here.
And you should be able to get by with fewer than 10 runs.

It would be nice to add some basic smoke test to ensure the installation 
actually works. Something like user-show admin.

Finally, please put integration tests in ipatests/test_integration, if 
there's not big reason against that.

Nitpick: in
     set([chr(c) for c in range(0x20, 0x7F)])
you could avoid creating a temporary list:
     set(chr(c) for c in range(0x20, 0x7F))

-- 
Petr³




More information about the Freeipa-devel mailing list