Closed Bug 1201131 Opened 9 years ago Closed 9 years ago

[swift 2.0] Cancelled Requests in Firefox Account Login tests

Categories

(Firefox for iOS :: General, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios-v1.0 --- ?
fxios-v1.0.5 --- ?
fxios-v1.1 --- fixed
fxios 1.1+ ---

People

(Reporter: fluffyemily, Assigned: rnewman, Mentored)

Details

Attachments

(1 file)

48 bytes, text/x-github-pull-request
fluffyemily
: review+
Details | Review
When executing Firefox Account integration tests, the request is being cancelled before execution causing the tests to fail.

I have no idea why this is happening. The cancel() on the Alamofire request is never called, but the response that we receive is 

FAILURE: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.accounts.firefox.com/v1/account/login?keys=true, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.accounts.firefox.com/v1/account/login?keys=true} 
  ▿ Failure : 2 elements
    ▿ .0 : Optional(<>)

The NSURLErrorDomain -999 occurs when a request is cancelled, or another request is executed that causes the existing request to cancel. I can see neither request() being called more than once, nor cancel() being called on the Alamofire request object.

The failing tests are:

Sync -> LiveAccountStorageTests -> testLive() and testStateMachine()
Accounts -> SyncAuthStateTests -> testLive()

Issues occur when calling FxAClient10: login() using test account information.

Logging in and syncing using the test account works totally fine from within the app.
Flags: needinfo?(rnewman)
Summary: [swift 2.0] Cancelled Requests in Firefox Account → [swift 2.0] Cancelled Requests in Firefox Account Login tests
I'm looking at this for a little while.

Note for those who come after: the failing AccountsTest has been changed so it doesn't fail, but still needs attention.
Assignee: nobody → rnewman
Flags: needinfo?(rnewman)
I think we're not retaining the request somehow, and so it's deiniting, which cancels the session.
Yup, that's it.

Each Client has its own Alamofire.Manager. We don't use the client once it kicks off its request, so it's automatically released. When it's released, it releases the Manager. The Manager's deinit cancels all outstanding requests.

Threading the client back through the call stack makes this test pass. I'd like to find a neater solution :)
Status: NEW → ASSIGNED
Component: Build & Test → General
Attached file Pull request
Attachment #8656153 - Flags: review?(sleroux)
Hardware: Other → All
Attachment #8656153 - Flags: review?(sleroux) → review?(etoop)
Attachment #8656153 - Flags: review?(etoop) → review+
f80cd8d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: