[Maas-devel] Problems when using MockLiveClusterToRegionFixture and TwistedRunTest
Gavin Panella
gavin.panella at canonical.com
Sun Aug 31 21:54:27 UTC 2014
On 31 August 2014 18:12, Graham Binns <graham.binns at canonical.com> wrote:
> Hi Gavin (cc'ing maas-devel for reference).
>
> So, I've been trying to get
> pserv_services.tests.test_dhcp_probe_service to work with
> TwistedRunTest, but when I run `bin/test.pserv
> pserv_services.tests.test_dhcp_probe_service`, my tests fail (but not
> in a useful way), and I see the following in the log output:
>
> "ERROR: Unable to probe for rogue DHCP servers: Connection to the
> other side was lost in a non-clean fashion."
>
> Do what I may I can't stop the "Connection to the other side was lost
> in a non-clean fashion." from appearing… Any ideas?
That's a small red-herring. I think that's because you're not shutting
down the service in the test.
However, there's an obscured problem:
- t.p.amp.UnhandledCommand is the exception to catch, not
t.spread.pb.NoSuchMethod.
- To get UnhandledCommand the protocol needs to completely lack support
for the method. A stub that raises UnhandledCommand is not enough
because AMP encodes that at a different level.
See http://paste.ubuntu.com/8200547/ for my fixes. To remove support for
a method I've mutated the protocol's _commandDispatch mapping. Better
would be to not pass the command in the call to makeEventLoop.
Hope that helps,
Gavin.
More information about the Maas-devel
mailing list