/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack_repository.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tests for pack repositories.
18
18
 
73
73
        """Packs do not need ordered data retrieval."""
74
74
        format = self.get_format()
75
75
        repo = self.make_repository('.', format=format)
76
 
        self.assertEqual('unordered', repo._fetch_order)
 
76
        self.assertEqual('unordered', repo._format._fetch_order)
77
77
 
78
78
    def test_attribute__fetch_uses_deltas(self):
79
79
        """Packs reuse deltas."""
80
80
        format = self.get_format()
81
81
        repo = self.make_repository('.', format=format)
82
 
        self.assertEqual(True, repo._fetch_uses_deltas)
 
82
        self.assertEqual(True, repo._format._fetch_uses_deltas)
83
83
 
84
84
    def test_disk_layout(self):
85
85
        format = self.get_format()
262
262
        self.addCleanup(tree.unlock)
263
263
        pack = tree.branch.repository._pack_collection.get_pack_by_name(
264
264
            tree.branch.repository._pack_collection.names()[0])
265
 
        # revision access tends to be tip->ancestor, so ordering that way on 
 
265
        # revision access tends to be tip->ancestor, so ordering that way on
266
266
        # disk is a good idea.
267
267
        for _1, key, val, refs in pack.revision_index.iter_all_entries():
268
268
            if key == ('1',):
601
601
        self.assertContainsRe(log_file, r'INFO  bzr: ERROR \(ignored\):')
602
602
        if token is not None:
603
603
            repo.leave_lock_in_place()
604
 
        
 
604
 
605
605
    def test_abort_write_group_does_raise_when_not_suppressed(self):
606
606
        self.vfs_transport_factory = memory.MemoryServer
607
607
        repo = self.make_repository('repo')
679
679
 
680
680
    def setUp(self):
681
681
        if not self.format_supports_external_lookups:
682
 
            raise TestNotApplicable("%r doesn't support stacking" 
 
682
            raise TestNotApplicable("%r doesn't support stacking"
683
683
                % (self.format_name,))
684
684
        super(TestPackRepositoryStacking, self).setUp()
685
685
 
816
816
    def get_format(self):
817
817
        return bzrdir.format_registry.make_bzrdir(self.format_name)
818
818
 
819
 
    def test_autopack_rpc_is_used_when_using_hpss(self):
 
819
    def test_autopack_or_streaming_rpc_is_used_when_using_hpss(self):
820
820
        # Make local and remote repos
821
821
        tree = self.make_branch_and_tree('local', format=self.get_format())
822
822
        self.make_branch_and_tree('remote', format=self.get_format())
831
831
        self.hpss_calls = []
832
832
        tree.commit('commit triggering pack')
833
833
        tree.branch.push(remote_branch)
834
 
        self.assertTrue('PackRepository.autopack' in self.hpss_calls)
835
 
 
836
 
 
837
 
def load_tests(basic_tests, module, test_loader):
 
834
        autopack_calls = len([call for call in self.hpss_calls if call ==
 
835
            'PackRepository.autopack'])
 
836
        streaming_calls = len([call for call in self.hpss_calls if call ==
 
837
            'Repository.insert_stream'])
 
838
        if autopack_calls:
 
839
            # Non streaming server
 
840
            self.assertEqual(1, autopack_calls)
 
841
            self.assertEqual(0, streaming_calls)
 
842
        else:
 
843
            # Streaming was used, which autopacks on the remote end.
 
844
            self.assertEqual(0, autopack_calls)
 
845
            # NB: The 2 calls are because of the sanity check that the server
 
846
            # supports the verb (see remote.py:RemoteSink.insert_stream for
 
847
            # details).
 
848
            self.assertEqual(2, streaming_calls)
 
849
 
 
850
 
 
851
def load_tests(basic_tests, module, loader):
838
852
    # these give the bzrdir canned format name, and the repository on-disk
839
853
    # format string
840
854
    scenarios_params = [
876
890
              format_supports_external_lookups=True,
877
891
              index_class=BTreeGraphIndex),
878
892
         ]
879
 
    adapter = tests.TestScenarioApplier()
880
893
    # name of the scenario is the format name
881
 
    adapter.scenarios = [(s['format_name'], s) for s in scenarios_params]
882
 
    suite = tests.TestSuite()
883
 
    tests.adapt_tests(basic_tests, adapter, suite)
884
 
    return suite
 
894
    scenarios = [(s['format_name'], s) for s in scenarios_params]
 
895
    return tests.multiply_tests(basic_tests, scenarios, loader.suiteClass())