Closed Bug 656984 Opened 13 years ago Closed 13 years ago

Fakeserver fails to support multiple connections properly

Categories

(MailNews Core :: Testing Infrastructure, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 9.0

People

(Reporter: jcranmer, Assigned: jcranmer)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 6 obsolete files)

Attached patch First stabs (obsolete) — Splinter Review
So, this is a deficiency that I only realized when I started running some IMAP tests under QAserver a while back but avoided fixing because it would likely require several test changes.

Right now, the fakeserver code uses the same handler for all connections, which is fine if your connection is more or less stateless (POP, SMTP), but is going to cause things to break if it's stateful (NNTP to a lesser degree, IMAP to a huge degree). The simplest thing to do is to more or less clone the handler, but JS cloning is easier said than done.

Basically, the simplest thing that could be done is to ask each handler to clone itself when we need a new connection. This may be necessary for the IMAP fakeserver, to allow us to conduct tests on what happens if we are notified of external changes to the same folder. The downside is that it makes getting "the" handler for a connection harder, especially since it seems tests have started using the handler instead of the daemon to store information (:-().

I'm attaching my first stab at this: I only worry about IMAP and NNTP servers for now, so all tests using POP and SMTP will fail. It also causes several IMAP tests to fail due to use of server._handler, which is going away in favor of server._handlers.

My two options are to create a pseudo-handler object which proxies to all current handlers (which might need to forward to not-yet-created handlers?), or to shunt most of the ._handler stuff to the daemon instead. Which may be preferable in general.
Attachment #532309 - Flags: feedback?(mbanner)
Attachment #532309 - Flags: feedback?(dbienvenu)
Attached patch New approach (obsolete) — Splinter Review
This takes a different approach. Instead of trying to clone handlers, the server gets passed the daemon (this solidifying the daemon/handler divide) and a function to create the handler. The downside is that this requires changing pretty much every time the server is constructed; the upside is that it is a cleaner approach.

With this patch, the local/, compose/, and news/ tests all pass (but not imap/); I've also run individually the other test folders.

Things that I want to do not in this patch:
1. Fix IMAP tests
2. Move passwords from handler to the daemon

I'm not certain about where stuff like "drop on STARTTLS" and the like should go. In the longer term, I want to move fakeserver into a separate process. This would probably entail proxying the daemon object as the IPC, but I'm not 100% sure what to do about the handlers...
Attachment #532309 - Attachment is obsolete: true
Attachment #532309 - Flags: feedback?(mbanner)
Attachment #532309 - Flags: feedback?(dbienvenu)
Attachment #533083 - Flags: feedback?(dbienvenu)
Attached patch Newer patch (obsolete) — Splinter Review
This brings me down to two failing IMAP tests, which appear to have more complicated needs for the handler.
Attachment #533083 - Attachment is obsolete: true
Attachment #533083 - Flags: feedback?(dbienvenu)
Attached patch fix test_imapFolderCopy.js (obsolete) — Splinter Review
I'll look at the other failing imap test tomorrow.
Attachment #533174 - Attachment is obsolete: true
Attached patch Combine all fixes (obsolete) — Splinter Review
And this has all of the fixes applied to it.
Attachment #533089 - Attachment is obsolete: true
Attachment #533278 - Attachment is obsolete: true
Attachment #533341 - Flags: review?(mbanner)
I'd recommend a try server push - Joshua, do you have try server access?
Blocks: 662176
Comment on attachment 533341 [details] [diff] [review]
Combine all fixes

This generally looks good, though the unit tests are currently failing:

http://build.mozillamessaging.com/tinderboxpushlog/?tree=ThunderbirdTry&rev=13416167abb7

Do you also have an example test that uses this? From what I could tell, there's none that take advantage of it yet.
Attachment #533341 - Flags: review?(mbanner) → review-
This fixes the pop password failure test as well as adds a test to make sure that the connection stuff works properly. It's been pushed to try: <http://build.mozillamessaging.com/tinderboxpushlog/?tree=ThunderbirdTry&rev=f6e95bfc55fc>.
Attachment #533341 - Attachment is obsolete: true
Attachment #554222 - Flags: review?(mbanner)
Comment on attachment 554222 [details] [diff] [review]
Fixes all issues I'm aware of

Review of attachment 554222 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks.
Attachment #554222 - Flags: review?(mbanner) → review+
Checked in to comm-central.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 9.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: