diff mbox

[OSSTEST,3/9] mg-schema-test-database: Wipe previous local plan data

Message ID 1450371968-27997-3-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson Dec. 17, 2015, 5:06 p.m. UTC
Whatever is in the user's cwd is unlikely to correspond to anything
real.  In principle it might be possible to obtain an official copy
from the real daemons, and massage it, or something, but that's a lot
of work.

Instead, just remove it when we start the test db daemons.

In principle it would be more correct to remove it when we set up the
test db, because it is at that point that we create the new view of
the world.  Removing the old plan data when we start daemons means
that if the user, who is testing, restarts the daemons, the
newly-created queue daemon does not have information about allocations
made with the previous daemon, and instead regards those allocations
as rogue.

However, removing the file only when the daemons are started means
that if the user has saved a data-plan.pl in their cwd for some other
reason we don't remove it unless the user is actually going to run the
daemons.  So I think this is preferable.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 mg-schema-test-database |    2 ++
 1 file changed, 2 insertions(+)

Comments

Ian Campbell Dec. 17, 2015, 5:22 p.m. UTC | #1
On Thu, 2015-12-17 at 17:06 +0000, Ian Jackson wrote:
> Whatever is in the user's cwd is unlikely to correspond to anything
> real.  In principle it might be possible to obtain an official copy
> from the real daemons, and massage it, or something, but that's a lot
> of work.
> 
> Instead, just remove it when we start the test db daemons.
> 
> In principle it would be more correct to remove it when we set up the
> test db, because it is at that point that we create the new view of
> the world.  Removing the old plan data when we start daemons means
> that if the user, who is testing, restarts the daemons, the
> newly-created queue daemon does not have information about allocations
> made with the previous daemon, and instead regards those allocations
> as rogue.
> 
> However, removing the file only when the daemons are started means
> that if the user has saved a data-plan.pl in their cwd for some other
> reason we don't remove it unless the user is actually going to run the
> daemons.  So I think this is preferable.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Would it make sense to remove data-projection.pl too? I suppose it isn't
consumed anywhere so is more or less harmless.

OOI do these test mode daemons do anything sensible with resource-
{plan,projection}.html and summary.html? Looks like they would clobber
things in $c{WebspaceFile}, which might be surprising to a user with two
test instances on the go. But that's a pretty obscure corner case I
suspect...

> ---
>  mg-schema-test-database |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mg-schema-test-database b/mg-schema-test-database
> index 818cf89..a4cb732 100755
> --- a/mg-schema-test-database
> +++ b/mg-schema-test-database
> @@ -553,6 +553,8 @@ daemons)
>  	withtest \
>  	exec_resetting_sigint ./ms-queuedaemon &
>  
> +	rm -f data-plan.pl
> +
>  	wait
>  
>  	;;
Ian Jackson Dec. 17, 2015, 5:37 p.m. UTC | #2
Ian Campbell writes ("Re: [OSSTEST PATCH 3/9] mg-schema-test-database: Wipe previous local plan data"):
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Thanks.

> Would it make sense to remove data-projection.pl too? I suppose it isn't
> consumed anywhere so is more or less harmless.

Precisely.

> OOI do these test mode daemons do anything sensible with resource-
> {plan,projection}.html and summary.html? Looks like they would clobber
> things in $c{WebspaceFile}, which might be surprising to a user with two
> test instances on the go. But that's a pretty obscure corner case I
> suspect...

If you don't run it as the same user, this is not a problem, because
the default WebspaceFile has $HOME in it.  I guess it might be
possible to have something check for this.

I would like to leave this for another day.  I don't see us running
test instances as the osstest user.

Ian.
Ian Campbell Dec. 17, 2015, 5:42 p.m. UTC | #3
On Thu, 2015-12-17 at 17:37 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [OSSTEST PATCH 3/9] mg-schema-test-database:
> Wipe previous local plan data"):
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Thanks.
> 
> > Would it make sense to remove data-projection.pl too? I suppose it
> > isn't
> > consumed anywhere so is more or less harmless.
> 
> Precisely.
> 
> > OOI do these test mode daemons do anything sensible with resource-
> > {plan,projection}.html and summary.html? Looks like they would clobber
> > things in $c{WebspaceFile}, which might be surprising to a user with
> > two
> > test instances on the go. But that's a pretty obscure corner case I
> > suspect...
> 
> If you don't run it as the same user, this is not a problem, because
> the default WebspaceFile has $HOME in it.

Right, I should have been clearer, I meant clobber things in the user's
WebspaceFile if they run two test instance at the same time.

>   I guess it might be
> possible to have something check for this.
> 
> I would like to leave this for another day.  I don't see us running
> test instances as the osstest user.

In any case another day is fine, it's pretty obscure for sure.

Ian.
Ian Jackson Dec. 17, 2015, 5:50 p.m. UTC | #4
Ian Campbell writes ("Re: [OSSTEST PATCH 3/9] mg-schema-test-database: Wipe previous local plan data"):
> On Thu, 2015-12-17 at 17:37 +0000, Ian Jackson wrote:
> > If you don't run it as the same user, this is not a problem, because
> > the default WebspaceFile has $HOME in it.
> 
> Right, I should have been clearer, I meant clobber things in the user's
> WebspaceFile if they run two test instance at the same time.

Ah, right.  I think the first person who wants to do that can do
something to separate out the WebspaceFiles :-).  It's not likely that
you wouldn't notice that you had a problem.

Ian.
Ian Campbell Dec. 17, 2015, 6:11 p.m. UTC | #5
On Thu, 2015-12-17 at 17:50 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [OSSTEST PATCH 3/9] mg-schema-test
> -database: Wipe previous local plan data"):
> > On Thu, 2015-12-17 at 17:37 +0000, Ian Jackson wrote:
> > > If you don't run it as the same user, this is not a problem,
> because
> > > the default WebspaceFile has $HOME in it.
> > 
> > Right, I should have been clearer, I meant clobber things in the
> user's
> > WebspaceFile if they run two test instance at the same time.
> 
> Ah, right.  I think the first person who wants to do that can do
> something to separate out the WebspaceFiles :-).  It's not likely
> that
> you wouldn't notice that you had a problem.

Agreed. Acked-by: Ian Campbell <ian.campbell@citrix.com>
diff mbox

Patch

diff --git a/mg-schema-test-database b/mg-schema-test-database
index 818cf89..a4cb732 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -553,6 +553,8 @@  daemons)
 	withtest \
 	exec_resetting_sigint ./ms-queuedaemon &
 
+	rm -f data-plan.pl
+
 	wait
 
 	;;