Re: mailbox referrals in 2.4.12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, Dec 16, 2011, at 02:05 PM, Andrew Morgan wrote:
> 
> I have never looked at Cassandane before (neat stuff!).
> 
> There were two tests I ran to verify referrals were disabled:
> 
> 1. Check that MAILBOX-REFERRALS is not present in the CAPABILITIES string 
> when connecting.

Easy enough to do, you can start by copying code from any of the several tests in Cassandane::Cyrus::Conversations which do something similar:

sub test_append
{
    my ($self) = @_;
    my %exp;

    # check IMAP server has the XCONVERSATIONS capability
    $self->assert($self->{store}->get_client()->capability()->{xconversations});



> 
> 2. Verify that a mailbox referral is not given:
> 
>    a. Connect to Cyrus as a regular user
>    b. RLIST "" "*"
>    c. CREATE "test"
>    d. DELETE "test"
> 
> When referrals are allowed, step 2d (DELETE "test") will cause a referral 
> to be generated.

Also reasonably straightforward, there are several tests which create and delete mailboxes, e.g. in Cassandane::Cyrus::Quota

sub test_using_storage
{
    my ($self) = @_;

...
    my $talk = $self->{store}->get_client();

    $talk->create("INBOX.sub") || die "Failed to create subfolder";
...
    # delete subfolder
    $talk->delete("INBOX.sub") || die "Failed to delete subfolder";
}

You may also find $talk->get_last_completion_response(), and $talk->get_response_code('referral') useful.


> 
> Of course, these tests only make sense in a Murder.
> 

Ah, now here you're heading off the beaten path a little bit.  We haven't currently got any Murder tests in Cassandane.  Now Cassandane is designed with multi-instance setups in mind, and we do test replication with a pair of instances, so it's entirely possible, but you'll be pioneering.

You need to be basically familiar with the Cassandane::Config and Cassandane::Instance classes; there's some documentation for them in doc/adding_tests.txt.  What you'll be doing is creating two or more Instance objects with carefully tuned Configs which set them all up in a Murder.  The code which does this for all the existing cases is in Cassandane::Cyrus::TestCase::_create_instances().  You'll want to copy that code and tweak it, and also disable the original by passing an argument to the TestCase constructor thusly

sub new
{
    my $class = shift;
    return $class->SUPER::new({
            instance => 0,
    }, @_);
}

I would also suggest writing a test for the non-Murder case first just to get the hang of the Cassandane environment.

Do let me know if you have any difficulty or need any more help.

-- 
Greg.
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/


[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux