-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: check that Audit doesn't screw up search
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_index_tier_audit_bug | ||
:min_version_3_3 :needs_search_xapian | ||
{ | ||
my ($self) = @_; | ||
|
||
my $xapdirs = ($self->{instance}->run_mbpath(-u => 'cassandane'))->{xapian}; | ||
|
||
my $talk = $self->{store}->get_client(); | ||
|
||
xlog "create a message"; | ||
$self->make_message("xyzzy") || die; | ||
$self->{instance}->run_command({cyrus => 1}, 'squatter', '-i'); | ||
|
||
xlog "assert that we can find the message"; | ||
my $uids = $talk->search('fuzzy', 'subject', 'xyzzy'); | ||
$self->assert_num_equals(1, scalar @$uids); | ||
|
||
xlog "assert that we have a part"; | ||
my ($gdocs, $parts) = $self->delve_docs($xapdirs->{t1} . "/xapian"); | ||
$self->assert_num_equals(1, scalar @$parts); | ||
$self->assert_num_equals(1, scalar @$gdocs); | ||
|
||
xlog "compact to t2 tier"; | ||
$self->{instance}->run_command({cyrus => 1}, 'squatter', '-z', 't2', '-t', 't1'); | ||
|
||
xlog "assert that the message is now in t2"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t2} . "/xapian"); | ||
$self->assert_num_equals(1, scalar @$parts); | ||
$self->assert_num_equals(1, scalar @$gdocs); | ||
|
||
xlog "assert that the message isn't in t1 still"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t1} . "/xapian"); | ||
$self->assert_num_equals(0, scalar @$parts); | ||
$self->assert_num_equals(0, scalar @$gdocs); | ||
|
||
xlog "assert that we can still find the message"; | ||
$uids = $talk->search('fuzzy', 'subject', 'xyzzy'); | ||
$self->assert_num_equals(1, scalar @$uids); | ||
|
||
xlog "run an audit"; | ||
$self->{instance}->run_command({cyrus => 1}, 'squatter', '-A'); | ||
|
||
xlog "assert that we can still find the message"; | ||
$uids = $talk->search('fuzzy', 'subject', 'xyzzy'); | ||
$self->assert_num_equals(1, scalar @$uids); | ||
|
||
xlog "assert that the message is now in t2"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t2} . "/xapian"); | ||
$self->assert_num_equals(1, scalar @$parts); | ||
$self->assert_num_equals(1, scalar @$gdocs); | ||
|
||
xlog "assert that the message isn't in t1 still"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t1} . "/xapian"); | ||
$self->assert_num_equals(0, scalar @$parts); | ||
$self->assert_num_equals(0, scalar @$gdocs); | ||
|
||
xlog "compact to t2 tier"; | ||
$self->{instance}->run_command({cyrus => 1}, 'squatter', '-z', 't2', '-t', 't1'); | ||
|
||
xlog "assert that the message is now in t2"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t2} . "/xapian"); | ||
$self->assert_num_equals(1, scalar @$parts); | ||
$self->assert_num_equals(1, scalar @$gdocs); | ||
|
||
xlog "assert that the message isn't in t1 still"; | ||
($gdocs, $parts) = $self->delve_docs($xapdirs->{t1} . "/xapian"); | ||
$self->assert_num_equals(0, scalar @$parts); | ||
$self->assert_num_equals(0, scalar @$gdocs); | ||
|
||
xlog "assert that we can still find the message"; | ||
$uids = $talk->search('fuzzy', 'subject', 'xyzzy'); | ||
$self->assert_num_equals(1, scalar @$uids); | ||
} |