[PATCH] samba-tool throws error if there is an empty FSMO role
Andrew Bartlett
abartlet at samba.org
Wed May 4 19:27:45 UTC 2016
On Mon, 2016-05-02 at 20:41 +0100, Rowland Penny wrote:
> So Andrew, how do I write a test for something that tests itself
> every
> time it runs ??? and if there are errors, these errors will probably
> have nothing to do with my code
Exactly! The vast majority of errors introduced into Samba,
particularly into the python code, are not intentional nor present at
the time that particular code was developed.
I'm quite happy to trust, for the purpose of argument, that at this
point in time, your patches are OK.
> Or to put it another way, I cannot think how to write a test for
> fsmo.py
> that doesn't replicate how I tested it before I sent my patch and
> there
> is no point in doing the same test over and over again, on the off
> chance it will develop an error.
The purpose of automated testing is to assert that this remains the
case!
Additionally, in python, there is no pre-compilation. That means that
the only way to guard against errors, such as we have seen in demote,
where additional arguments are added BY OTHERS to functions called, is
to run the code, and assert at the very least successful completion.
Ideally we also assert some meaningful output, against what we expect,
given the environment it runs in.
I know it feels really odd writing an assertion in much the same way as
the code it is testing does internally - but it works, partly because
the unintentional or helpful fix typically won't also unintentionally
update the test to mask a breakage.
Without continuous integration, with such a small team Samba would not
be what it is today - we would be chasing our tail, endlessly fixing
our own regressions.
I hope this clarifies things,
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list