[Pulp-list] Fwd: Unittests not cleaning up & sending events on regular bus pulp listens to

John Matthews jmatthew at redhat.com
Wed Dec 15 12:31:26 UTC 2010


----- Forwarded Message -----
From: jdobies at redhat.com
To: "John Matthews" <jmatthew at redhat.com>
Cc: "pulp-list" <pulp-list at redhat.com>
Sent: Tuesday, December 14, 2010 7:06:41 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Pulp-list] Unittests not cleaning up & sending events on regular bus pulp listens to

+1

In a unit test, anything like that that touches the bus should be mocked out. I did something similar in the test_CDs_API.py test so I can verify the bus calls are being made, but not actually hit the bus. 

John - can you please forward this to pulp-list? They seem to bounce emails from my phone. 

Sent from my iPhone

On Dec 14, 2010, at 6:50 PM, John Matthews <jmatthew at redhat.com> wrote:

> When running the unittests garbage is being leftover in the mongo database, "_database". (Note: we are using 2 mongo databases, "_database" for regular pulp and "pulp_unittest" for unit tests)
> 
> The tricky part is the unittests are connecting to "pulp_unittest".  I've been a bit puzzled as to what was creating the entries in "_database".  
> 
> I noticed I only see this problem when pulp is running under apache and I run the unittests.
> It looks like pulp under apache is receiving a "repo.created" event generated by the unit tests, pulp then proceeds to create a repo for this.  
> 
> I believe this explains why the repo information isn't being cleaned up.  The unittests are running against "pulp_unittest", so all of the clean methods are cleaning that database connection.  The unittests leave "_database" alone.
> 
> I don't think we realized this behavior in the past because the unit tests were using the same database as pulp, so clean was removing everything.
> 
> 
> Should the unit tests be allowed to send an event on the bus?  I'm thinking No.  Or at the least if we want to test sending events around, lets override the config so this is talking to a separate test setup that won't impact any running instances?  Any thoughts?
> 
> 
> 
> 
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list




More information about the Pulp-list mailing list