Problematic test: samba.tests.samba_tool.demote

Andrew Bartlett abartlet at samba.org
Wed Jun 27 18:33:11 UTC 2018


On Wed, 2018-06-27 at 15:58 +0100, Noel Power wrote:
> Andrew/Gary
> 
> Hi Guys I need some help/advice or a dig out wrt the
> samba.tests.samba_tool.demote test. This test is failing in my PY3 wip
> branch. However the reason it fails is that the test itself doesn't
> clean up properly after it completes, running the test a second time
> (which is what happens when PY3 is enabled) and it fails. You don't even
> need to involve PY3, just rerun the test a second time e.g.
> 
> make testenv SELFTEST_TESTENV="vampire_dc"
> 
> then manually runt the test twice
> 
> PYTHONPATH=bin/python:$(PWD)/samba/python
> CONFIGFILE=./st/vampire_dc/etc/smb.conf /usr/bin/python2
> $(PWD)/source4/scripting/bin/subunitrun  $LOADLIST
> samba.tests.samba_tool.demote -U"Administrator%locDCpass1"
> 
> test:
> samba.tests.samba_tool.demote.DemoteCmdTestCase.test_demote_and_remove_dns
> time: 2018-06-27 14:54:28.102869Z
> successful:
> samba.tests.samba_tool.demote.DemoteCmdTestCase.test_demote_and_remove_dns
> time: 2018-06-27 14:54:28.102928Z
> time: 2018-06-27 14:54:28.103004Z
> 
> PYTHONPATH=bin/python:$(PWD)/samba/python
> CONFIGFILE=./st/vampire_dc/etc/smb.conf /usr/bin/python2
> $(PWD)/source4/scripting/bin/subunitrun  $LOADLIST
> samba.tests.samba_tool.demote -U"Administrator%locDCpass1"
> 
> time: 2018-06-27 14:54:44.139799Z
> test:
> samba.tests.samba_tool.demote.DemoteCmdTestCase.test_demote_and_remove_dns
> time: 2018-06-27 14:54:45.869655Z
> failure:
> samba.tests.samba_tool.demote.DemoteCmdTestCase.test_demote_and_remove_dns [
> Traceback (most recent call last):
>   File "bin/python/samba/tests/samba_tool/demote.py", line 96, in
> test_demote_and_remove_dns
>     self.assertCmdSuccess(result, out, err)
>   File "bin/python/samba/tests/samba_tool/base.py", line 110, in
> assertCmdSuccess
>     exit, out, err, msg))
> AssertionError: exit[-1] stdout[] stderr[Using localdc as partner server
> for the demotion
> Deactivating inbound replication
> Asking partner server localdc to synchronize from us
> Changing userControl and container
> Error while demoting, re-enabling inbound replication
> ERROR(runtime): Error while sending a removeDsServer of
> CN=LOCALVAMPIREDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=samba,DC=example,DC=com: 
> - (31, 'WERR_GEN_FAILURE')
> ]:
> ]

> So I guess the ntds_dn and associated records don't exists anymore, I
> tried manually trying to repromote the DC in the cleanUp but failed to
> get it to work (mostly likely 'cause I don't know what I am doing :-))
> 
> Ideas or a fix welcome :-)

G'Day Noel,

You are correct, this test (deliberately) destroys the test environment.

You can't really put it back, it just isn't an idempotent test. 

Perhaps test dropping one environment with python2 and a different one
with python3, or find a way to just unit test some of the elements
against a local or saved provision?

Sorry for the sharp edges!

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