<br><br><div class="gmail_quote">On Sun, Feb 10, 2013 at 3:21 PM, Monty Taylor <span dir="ltr"><<a href="mailto:mordred@inaugust.com" target="_blank">mordred@inaugust.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
On 02/10/2013 11:37 AM, John Griffith wrote:<br>
><br>
><br>
> On Sun, Feb 10, 2013 at 3:03 AM, Huang Zhiteng <<a href="mailto:winston.d@gmail.com">winston.d@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:winston.d@gmail.com">winston.d@gmail.com</a>>> wrote:<br>
><br>
> John, Monty, Mark,<br>
><br>
> I think one example is unit tests involving test case against entry<br>
> points which requires installation. I guess that's John's most<br>
> annoying thing.<br>
><br>
> For this special case, I think switching from run_tests.sh to tox (or<br>
> even ditching run_tests.sh) is the right solution. I'm working on a<br>
> patch for Cinder to make this change<br>
> (<a href="https://review.openstack.org/#/c/21597/" target="_blank">https://review.openstack.org/#/c/21597/</a>). It's not ready yet as I<br>
> met some difficulty with coverage tests, but as a starter, you can try<br>
> functionality other than coverage tests.<br>
><br>
> On Sun, Feb 10, 2013 at 5:23 AM, Monty Taylor <<a href="mailto:mordred@inaugust.com">mordred@inaugust.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:mordred@inaugust.com">mordred@inaugust.com</a>>> wrote:<br>
> ><br>
> ><br>
> > On 02/09/2013 01:59 PM, Mark McLoughlin wrote:<br>
> >> Hi John,<br>
> >><br>
> >> On Sat, 2013-02-09 at 12:15 -0700, John Griffith wrote:<br>
> >>> We seem to be going down a path of requiring more and more<br>
> infrastructure<br>
> >>> and reliance from modules inside of the respective projects code<br>
> base, and<br>
> >>> lately (the most annoying thing to me) is actually requiring the<br>
> >>> installation of the project and it's services in order for our<br>
> unit tests<br>
> >>> to run.<br>
> >><br>
> >> Got an example?<br>
> ><br>
> > Yes. I'd also like an example.<br>
> ><br>
> > FWIW - I agree with the sentiment that our unittests should be<br>
> simple to<br>
> > run and that cross-project testing should be the purview of<br>
> integration<br>
> > tests.<br>
> ><br>
> > Monty<br>
> ><br>
> > _______________________________________________<br>
> > OpenStack-dev mailing list<br>
> > <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
</div>> <mailto:<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>><br>
<div class="im">> > <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
><br>
><br>
> --<br>
> Regards<br>
> Huang Zhiteng<br>
><br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
</div>> <mailto:<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>><br>
<div class="im">> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
><br>
> Sorry for dropping the email then going MIA.<br>
><br>
> There are multiple things I wanted to get some thought around, I'll<br>
> start with what I believe are the easier ones first:<br>
><br>
> 1. I don't believe that we should require the installation of Cinder to<br>
> run the Cinder unit tests<br>
> This to me clearly crosses the line in to functional or<br>
> integration territory, and moving it in to<br>
> a venv (tox, or otherwise) doesn't address my issue with it.<br>
> Sorry Winston but right now 21597 does<br>
> exactly what I don't want.<br>
><br>
> Today for Cinder I have the test-requires packages and other<br>
> required items all installed on my laptop and other machines.<br>
> I can clone the Cinder repo and run all of the tests using<br>
> 'run_tests.sh -N' in less than a minute. Lately unit tests are coming<br>
> online that depend on the egg info being installed as Winston<br>
> touched on.<br>
<br>
</div>I've got a patch coming that will help with that.<br></blockquote><div><br>Cool, I started looking at the version change and how to get around this already but I'll let you finish it :)<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> 2. I haven't figured out what Tox versus Nose buys me in Cinder.<br>
> I understand in Nova and others there may be advantages due to<br>
> parallelism and some other enhancements, but in my<br>
> case my test cycle time has actually increased by having to<br>
> install the tox venv when I do a fresh clone, and in the case<br>
> of Nova, I *think* my tests are running a bit faster but really<br>
> I don't feel that I actually know what's being run and the results.<br>
<br>
</div>tox vs. nose isn't a thing. There are two sets of things:<br>
<br>
a) nose vs. testr - this is the thing with parallelism, and also with<br>
using a test runner that doesn't inject evil into things. When we<br>
propose a patch to cinder to migrate you to testr, we will propose a<br>
patch to run_tests.sh that will run testr instead of nose, and your<br>
above referenced workflow will work as usual and will get faster and<br>
more consistent.<br>
<br>
b) tox vs. run_tests - this is about how virtualenvs are created and<br>
managed. The use of tox has been enabled in cinder for as long as it has<br>
existed and nothing has changed with that recently. If you run<br>
run_tests, nothing about tox will interface with you life.<br>
<br>
However - honestly, if what you want to do is install the requirements<br>
locally, not use virtualenvs and run things quickly, once we get testr<br>
landed, you should stop using run_tests.sh and just run testr directly.<br>
But it's not required.<br></blockquote><div><br>Ok, that makes sense, thanks for educating me on that. I personally could care less what the command I use is, it's the basic work flow that I'm a big fan of. I have been trying to get this working correctly in Nova and think I have it sorted using "testr run", and that's fine WRT to this particular item.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> These first two items are the main things I'm looking for feed-back from<br>
> folks on, the rest of this email is more around test philosophy, and I<br>
> don't think I'm interested in trying to come to an agreement or change<br>
> on things here. I'd just like to raise some awareness, if anybody is<br>
> interested in pursuing some of this, maybe we can all get together and<br>
> chat at the summit. If people think it's ridiculous that's fine too.<br>
<br>
</div>The "must install cinder to run unit tests" is a bug. Patch is on its<br>
way... (and sorry, there's about 100 use cases up in there and we missed<br>
one when we did the recent version code)<br></blockquote><div><br>So TBF here, I wasn't even going to mention the version patch. I happened to miss this in my review because coincidentally I was working in devstack when I saw your patch and just pulled it and ran it there so everything was fine. On the other hand, there have been patches submitted however that intentionally require cinder to be installed, I've let one go through and added a skip if cinder not installed, and other's I've pushed back and said 'thanks but no thanks". I feel the same way about 3'rd party storage device vendors requiring pip install of their library/packages for unit tests but have made exceptions mostly because I don't know that we haven't had much mind share around this.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> In my mind you have unit tests, functional tests and integration tests.<br>
> Unit tests to me aren't designed to find bugs, or test for regressions.<br>
> They're specifically to test a unit of code that I've written, and the<br>
> tests should only depend on that unit of code that I'm intending to test.<br>
><br>
> So for example if I write a Cinder driver called 'super_cool_driver', I<br>
> have a single file of unit tests that tests super_cool_driver methods<br>
> and NOTHING else. It has no dependencies on any other files/modules in<br>
> the Cinder project. It's only purpose is to make sure that<br>
> super_cool_driver's behaviours are in fact what I intended and expect.<br>
> It also ensures that somebody later doesn't change those behaviours<br>
> inadvertently.<br>
><br>
> Testing the interaction with other Cinder modules should be done through<br>
> functional tests. This is where devstack exercises would come in to<br>
> play. Currently I don't think we put enough emphasis here, when<br>
> somebody submits a bug fix for something we often say "You need a unit<br>
> test to catch this sort of thing in the future", maybe that's true in<br>
> some cases but I'd argue that we should be saying "You need a test in<br>
> devstack or tempest to catch this in the future". One of the main<br>
> reasons unit tests aren't very helpful here IMO is that in most cases a<br>
> bug results from a refactor or enhancement in the code. Most of the<br>
> time when folks make these enhancements they also modify the unit test<br>
> to behave the way they "expect" it to and think it should. The result<br>
> is they just create a unit test that verifies the incorrect behaviour.<br>
<br>
</div>I agree that we should, across the board, suggest better tempest coverage.<br></blockquote><div><br>Yeah, I'm guilty here as well but it's something I'd like to make improvements to in H.<br> <br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im HOEnZb"><br>
> Another point that came up; we have "fake" volume objects and such<br>
> spread out and created in multiple places throughout the Cinder unit<br>
> tests. Some folks use the fake class that's set up, and most create a<br>
> fake in their setup, or on the fly in the test case they're writing.<br>
> This creates a bit of a problem if the volume object ever changes (you<br>
> have to find every fake that's created and modify it, then modify any<br>
> test that uses it etc etc). It would be great if at some point in the<br>
> future we had good fakes for things like volume objects, instance<br>
> objects etc (sort of along the lines of what Robert mentioned, but I'm<br>
> not sure I'm thinking of the same scope as he mentioned).<br>
><br>
> An example of this was recently Sean Dague asked me about test objects<br>
> for Cinder (Volumes, Snapshots, Types etc), I was kinda surprised but we<br>
> didn't have an existing set of updated fakes to represent these things.<br>
> Seems like it would be smart to have these things (both objects and DB<br>
> entries) to use throughout the unit tests to provide consistency and<br>
> make tests a bit more realistic, rather than just rolling your own fake<br>
> object to fit the test your writing it for.<br>
><br>
> Thanks,<br>
> John<br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br>