[RFC] readonly branch and repository tests

Martin Pool mbp at sourcefrog.net
Fri Jun 22 04:38:31 BST 2007


On 6/22/07, Robert Collins <robertc at robertcollins.net> wrote:
> We have several scenarios where we want to make sure bzr can do readonly
> operations on branches and repositories, but not read-write ones.
>
> Specifically:
>  - Bundle 5 is likely to be a branch-as-a-bundle (or at least I think
> its well worth trying for) - this is a readonly repository and branch
> implementation, so mutating tests are pointless.
>  - bzr-hg, bzr-git, bzr-cvs if it is created - none of these should be
> required to write to the backend losslessly, and being able to just
> 'pull' with confidence would be a great win. And we cannot represent in
> these other systems all the things that we do - forcing a real-time
> export (which is what write support to a foreign format is) - as the
> price to be able to test these things is basically ugly.
>
> So I'm thinking about how to structure our per-implementation tests to
> cater for this.
>
> I'm thinking that there are three basic steps:
>  - tag readonly implementations somehow - starting with Branch4
>  - split out the tests of mutating interfaces somehow.
>   * Possibly decorate them
>   * possibly split the directories to keep our simple approach
>   * possibly a different list in the per-FOO/__init__.py.
>  - change the readonly tests to call a method on self after setting up
> the scenario, which will transform the branch/repository into the real
> format needed, and then the test can proceed. I see this working much
> like the InterTree adaption function works - which has been quite
> successful I thought in letting us test things that interact with
> RevisionTree.

That sounds reasonable.

In testing it seems that we'll typically want to put some information
into the repository while it's mutable, then examine it in the
readonly form.  With bundles it would be straightforward to write into
eg the default format then convert to a repository, but if we want to
thoroughly test a foreign repository and we can't convert from bazaar
into that format we might need to give a more abstract description of
what data should be in there.

We want it to be easy for people to make the right decision about
which tests should be applied to readonly formats and when the
conversion to readonly is done.  It might be easy to accidentally omit
to really exercise the readonly format by continuing to use the
writable one.

In some ways it would be nice to have a different base class for these
tests, so that they can be stored in the same file as the other tests
for that logical area, but also clearly distinct.

-- 
Martin



More information about the bazaar mailing list