|
Revision 162, 1.1 kB
(checked in by bradfitz, 2 years ago)
|
|
Checking in changes prior to tagging of version 1.05. Changelog diff is:
Index: Changes
===================================================================
--- Changes (revision 161)
+++ Changes (working copy)
@@ -1,3 +1,5 @@
+1.05 (august 2, 2007)
+
- 'prune' and 'gc' commands commands for both Amazon
and Filesystem targets. from Alessandro Ranellucci <aar@…>.
|
| Line | |
|---|
| 1 | # -*-perl-*- |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use Test::More tests => 9; |
|---|
| 5 | |
|---|
| 6 | use Brackup::Test; |
|---|
| 7 | use FindBin qw($Bin); |
|---|
| 8 | use Brackup::Util qw(tempfile); |
|---|
| 9 | |
|---|
| 10 | ############### Backup |
|---|
| 11 | |
|---|
| 12 | my ($digdb_fh, $digdb_fn) = tempfile(); |
|---|
| 13 | close($digdb_fh); |
|---|
| 14 | my $root_dir = "$Bin/data"; |
|---|
| 15 | ok(-d $root_dir, "test data to backup exists"); |
|---|
| 16 | my ($backup_file, $backup, $target) = do_backup( |
|---|
| 17 | with_confsec => sub { |
|---|
| 18 | my $csec = shift; |
|---|
| 19 | $csec->add("path", $root_dir); |
|---|
| 20 | $csec->add("chunk_size", "2k"); |
|---|
| 21 | $csec->add("digestdb_file", $digdb_fn); |
|---|
| 22 | }, |
|---|
| 23 | ); |
|---|
| 24 | |
|---|
| 25 | ############### Add an orphan chunk |
|---|
| 26 | |
|---|
| 27 | my $orphan_chunks_count = int(rand 10); |
|---|
| 28 | for (1..$orphan_chunks_count) { |
|---|
| 29 | my $chunk = Brackup::StoredChunk->new; |
|---|
| 30 | $chunk->{_chunkref} = \ "foobar $_"; |
|---|
| 31 | $target->store_chunk($chunk); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | ############### Do garbage collection |
|---|
| 35 | |
|---|
| 36 | my $removed_count = $target->gc; |
|---|
| 37 | ok($removed_count == $orphan_chunks_count, "all orphan chunks removed"); |
|---|
| 38 | |
|---|
| 39 | __END__ |
|---|