cyrusimap / cassandane

Other
6 stars 11 forks source link

Make all tests work with new defaults for altnamespace and unixhierarchysep #13

Open brong opened 7 years ago

brong commented 7 years ago

There are a couple of things here. Ideally the tests should work with either setting unless they're explicit to one of the settings, in which case they're already overriding it.

Tons of tests currently fail because they have hard coded folder names in them. There needs to be a function call which takes a userid and a list of folder names.

$self->{store}->foldername('cassandane'); #INBOX

$self->{store}->foldername('cassandane', 'SubFolder'); #INBOX.Subfolder : SubFolder

$self->{store}->foldername('cassandane', 'SubFolder', 'deep', 'tree'); #INBOX.SubFolder.deep.tree : SubFolder/deep/tree

$self->{store}->foldername(undef, "shared", "stuff"); # shared.stuff : shared/stuff

And anything which uses a name anywhere should use this function to create the folder name. It will do the UTF7 encoding too...

ajaysusarla commented 7 years ago

issue #25 is a duplicate of this.

elliefm commented 6 years ago

I think the way to approach this is to build a separate tester (and a Tester module to spawn it), which defines its tests/results in a config-agnostic format and then runs each test against every combo of hierarchy separator/namespace/virtdomains configuration. I think this would shake out a lot of edge case bugs that we aren't noticing at the moment because of our FastMail-config blinkers, and would be amazing for regression testing. I would wanna merge the entire suite of testrfc tests from List.pm into it at a minimum.

I guess this'd end up being similar in spirit to the Dovecot ImapTest, so a possible alternate approach might be to refactor our own ImapTest.pm wrapper to just run the Dovecot suite a bunch of times with all the Cyrus config permutations.

elliefm commented 4 years ago

@rsto has suggesting adding a :NoAltNamespace magic which explicitly sets "altnamespace=no" in the same way that :AltNamespace sets "altnamespace=yes", and annotating all the tests that expect the old default appropriately. This will fix the need for an override in cassandane.ini, while also keeping our current crop of tests for both configurations, without dramatic rewriting in the meantime.

We could probably just do the same for :UnixHierarchySep too.

elliefm commented 4 years ago

We now have a :NoAltNamespace magic as of 71b1a59. Still need to do the same thing for :NoUnixHierarchySep