qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Minor modification to python client
Date Tue, 05 Sep 2006 13:53:40 GMT
Yup I knew the cleanup stuff was a bit dodgy. How does this sound:

TestBase: add these functions:

assertChannelOpen(chan): fail if chan is closed or has an exception.
assertChannelClean(chan): fail if channel has exceptions 
openChannel(id): return channel, add it to self.channelsUsed

In unit tests:
 1. Call openChannel rather than using client directly.
 2. After nowait ops call assertChannelOpen (*)

In tearDown:
 1. for ch in self.channelsUsed: close, note any exceptions
 2. Open new channel to clean up qs and exs. note any exceptions
 3. Close that channel
 4. If any exceptions noted above, fail the test.

I'll implement that today unless anyone has better ideas.


On Mon, 2006-09-04 at 11:04 +0100, Gordon Sim wrote:
> I made a minor modification to the python client module in order to 
> write tests that check channel exceptions as sent by the broker.
> Specifically I added a channel_close handler method to the clients 
> delegate which just adds the response to the channels response queue 
> (unblocking any invocations waiting for responses) and then closes the 
> channel.
> As a channel_close isn't recognised as an expected response, this 
> results in a ValueError being raised, with the message frame as the 
> argument, on the invocation thread.
> I'm not sure whether this is the desired way of handling this problem. 
> Its just a three line change though so should be easy to back out.
> One outstanding issue is that if nowait is set then the exception will 
> not be thrown, but the channel will be closed; perhaps we want to store 
> the details of the close so that these can be included in the exception 
> raised when a closed channel has any invocation attempted on it.
> Another issue, with regard to the test framework, is that the automatic 
> queue cleanup will fail if the main channel encounters a channel 
> exception (due to the channel being closed before the delete operation 
> is attempted).

View raw message