On Fri, Apr 27, 2012 at 11:29:55AM -0400, Bernardo Dal Seno wrote: > On Fri, Apr 27, 2012 at 11:22, Iustin Pop <[email protected]> wrote: > > On Fri, Apr 27, 2012 at 11:14:49AM -0400, Bernardo Dal Seno wrote: > >> On Fri, Apr 27, 2012 at 04:20, Iustin Pop <[email protected]> wrote: > >> > On Thu, Apr 26, 2012 at 07:45:33PM -0400, Bernardo Dal Seno wrote: > >> >> On Thu, Apr 26, 2012 at 07:34, Iustin Pop <[email protected]> wrote: > >> >> > On Thu, Apr 26, 2012 at 12:07:02AM +0200, Michael Hanselmann wrote: > >> >> >> This script can be used to check if an instance is running or > >> >> >> stopped at > >> >> >> various points during a QA run. Environment variables are used to > >> >> >> pass > >> >> >> the most essential information. > >> >> > > >> >> > Not sure if this is a good approach. You rely on manually annotating > >> >> > the > >> >> > generic instance function with sprinkled CheckInstance tests. > >> >> > > >> >> > I think we should not do such manual annotation and instead annotate > >> >> > the > >> >> > instance tests themselves with a running yes/no flag after it. In the > >> >> > sense that after each test, we should automatically check whether the > >> >> > instance is running or not. > >> >> > >> >> It seems to me that each test should check that the instance is in the > >> >> correct state, without any flag (each test should know what the > >> >> correct state is). > >> > > >> > How can a test know this automatically?? > >> > > >> > Tell me how from this test: > >> > > >> > AssertCommand(["gnt-instance", "stop", instance]) > >> > > >> > You can *automatically* deduce the fact that the instance should be down > >> > :) > >> > >> That would be nice, but I suppose that something like this could be enough: > >> > >> def TestInstanceShutdown(instance): > >> AssertCommand(["gnt-instance", "shutdown", instance["name"]]) > >> CallAFunctionThatRisesAnExceptionIfTheInstanceIsUP(instance["name"]) > > > > Well, this is exactly what I meant. Instead of doing it in the caller of > > TestInstanceShutdown, do it directly in TestInstanceShutdown, possibly > > via a decorator. > > > > "instead annotate the instance tests themselves". > > Nice. The "with a running yes/no flag after it" part made me think you > wanted to add a new parameter to all the tests, hence my comment.
Ah no, that would not make sense, of course. thanks, iustin
