[PATCH] samba-tool throws error if there is an empty FSMO role
Rowland Penny
repenny241155 at gmail.com
Fri Apr 8 21:01:40 UTC 2016
On 08/04/16 21:30, Andrew Bartlett wrote:
>
>
> All of the above is entirely possible in 'make test'. Indeed, I missed
> it in my first search, much of that part is tested here:
> source4/torture/drs/python/fsmo.py
I have had a look, it looks like something to build on.
>
> However, all I'm asking for in this case is that you show that 'samba
> -tool fsmo show' produces non-faulting output in all of the
> environments we already have, and the output is reasonable. Bonus
> points if it checks the results are correct.
>
I will try.
>> Would you like to advise me just how I could that without ending up
>> with
>> a test that wasn't several times the size of fsmo.py and wouldn't
>> take
>> an excessive time to run.
> Tests are often the same size as the code they test, and I don't expect
> it to take more than trivial time to run.
>
> Have a look at timecmd.py and rodc.py. See how they assert that the
> command ran successfully, and see how they check for strings in the out
> (output) and err (stderr) variables?
>
> That is what you need to do. Then run that in the different
> environments by changing source4/selftest/tests.py to run that test in
> each of fl2000dc, fl2003dc, fl2008r2dc and vampire_dc
I can only try.
>
>> I personally think that testing fsmo.py in the way you suggest is a
>> waste of time, if everything is created correctly (by code that isn't
>> in
>> fsmo.py) then fsmo.py will work without my changes, but it seems that
>> there are times when everything isn't created correctly and then
>> fsmo.py
>> throws an error.
> Indeed. This happens in the real world. It is great that you patched
> it - I already needed to point a client at the patch when they hit this
> exact issue!
Oh great, you will use my code, but won't put it into Samba :-D
>> Tests are all well and good, but only for things that are created
>> automatically. The code in fsmo.py shows, transfers or seizes FSMO
>> roles, it doesn't (in the first instance) create the owners of these
>> roles, bearing this in mind, perhaps the tests you ask for should be
>> aimed at other code.
>>
>> Please bear in mind, whilst we are arguing about this, there is
>> faulty
>> code in fsmo.py.
> I agree, and I would like it fixed. I'm also trying to teach you how
> to write tests for your code, so that it stays that way.
I am a mechanic by trade, one of the first things you learn, if isn't
broken, you do not fix it, this is why I am finding it hard to envisage
the code to break something and then test for the breakage. :-)
>
> I know I'm asking you to spend non-trivial additional time on this. I
> realise that I'm stretching you and I know that is frustrating.
>
> Most of us who work on Samba find ourselves spending as much time on
> the tests as the original code, and that has thankfully become part of
> our culture, and what makes Samba as great as it is.
>
> My hope is that you can learn the art and habit of automated testing,
> because you have shown great ability to learn the Samba craft already,
> and it makes your patches much, much, easier to accept.
OK, I understand where you are coming from and lets see where I go from
here, I normally just want to fix things :-)
Rowland
More information about the samba-technical
mailing list