Closed Bug 569744 Opened 14 years ago Closed 14 years ago

Delayed loading of service.js causes test failures

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Mardak, Assigned: philikon)

References

Details

Attachments

(2 files, 1 obsolete file)

Running syncengine_sync with test coverage tool makes it take long enough for the delayed loading component (10 seconds) to force a load of service.js. Some reason this results in the service to mark itself as disabled (it says no crypto), but the test is actually using the crypto component already I believe.

Somehow the service being disabled causes the other parts of the test to fail.. it says meta is undefined when trying to upload records.
Depends on: 557588
Assignee: nobody → philipp
Attached patch v1 (obsolete) — Splinter Review
Have FakeCryptoService.generateRandomIV() return 24 bytes so that Weave.Service._checkCrypto() believes it's the real deal. Also fix an undeclared variable.

Now test_syncengine_sync no longer fails for me when running with the coverage tool enabled.
Attachment #453322 - Flags: review?(edilee)
Comment on attachment 453322 [details] [diff] [review]
v1

>+++ b/services/sync/tests/unit/head_helpers.js
>   generateRandomIV: function() {
>-    return "fake-random-iv";
>+    return "fake-fake-fake-random-iv";
Probably best to leave a comment here about the length.
Attachment #453322 - Flags: review?(edilee) → review+
Attached patch v1.1Splinter Review
Comment added.
Attachment #453322 - Attachment is obsolete: true
http://hg.mozilla.org/services/fx-sync/rev/2a4e2281a315
Have FakeCryptoService.generateRandomIV() return 24 bytes so that Weave.Service._checkCrypto() believes it's the real deal. Fix undeclared variable.
Status: NEW → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 1.4
Seems like test_records_crypto is failing sometimes. Seems like the service starts loading if the key generation takes "too long".

A successful run looks like:

2010-06-23 13:09:14     run_test             INFO       Setting up server and authenticator
2010-06-23 13:09:14     run_test             INFO       Generating keypair + symmetric key
2010-06-23 13:09:14     PubKeyManager        DEBUG      Generating RSA keypair
2010-06-23 13:09:18     PubKeyManager        DEBUG      Generating RSA keypair... done
2010-06-23 13:09:18     run_test             INFO       Setting up keyring
2010-06-23 13:09:18     run_test             INFO       Creating and encrypting a record
2010-06-23 13:09:18     PubKeyManager        TRACE      Importing record: http://localhost:8080/pubkey
2010-06-23 13:09:18     Net.Resource         DEBUG      GET success 200 http://localhost:8080/pubkey
2010-06-23 13:09:18     PrivKeyManager       TRACE      Importing record: http://localhost:8080/privkey
2010-06-23 13:09:18     Net.Resource         DEBUG      GET success 200 http://localhost:8080/privkey
2010-06-23 13:09:18     run_test             INFO       Decrypting the record


The failure looks like:

2010-06-23 13:08:22     run_test             INFO       Setting up server and authenticator
2010-06-23 13:08:22     run_test             INFO       Generating keypair + symmetric key
2010-06-23 13:08:22     PubKeyManager        DEBUG      Generating RSA keypair
2010-06-23 13:08:31     PubKeyManager        DEBUG      Generating RSA keypair... done
2010-06-23 13:08:31     run_test             INFO       Setting up keyring
2010-06-23 13:08:31     run_test             INFO       Creating and encrypting a record
2010-06-23 13:08:31     PubKeyManager        TRACE      Importing record: http://localhost:8080/pubkey
2010-06-23 13:08:32     Engine.Clients       DEBUG      Engine initialized
2010-06-23 13:08:32     Engine.Clients       DEBUG      Resetting clients last sync time
2010-06-23 13:08:32     Service.Main         INFO       Loading Weave 1.4a1pre
2010-06-23 13:08:33     Service.Main         INFO       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a6pre) Gecko/20100623 Minefield/3.7a6pre
2010-06-23 13:08:33     Net.Resource         DEBUG      GET success 200 http://localhost:8080/pubkey
2010-06-23 13:08:33     Net.Resource         DEBUG      GET fail 401 http://localhost:8080/privkey
2010-06-23 13:08:33     Service.Main         DEBUG      Finding cluster for user
2010-06-23 13:08:33     Net.Resource         DEBUG      GET fail 400 https://auth.services.mozilla.com/user/1.0//node/weave
An exception occurred: TypeError: privkey is null
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
The request before service is started:

atob('Z3Vlc3Q6Z3Vlc3Q=') = guest:guest

After service starts:

atob('OnVuZGVmaW5lZA==') = :undefined

So seems like the defaultAuthenticator is overridden by the ID-based BasicAuthenticator
Attached patch part 2Splinter Review
Explicitly set username pref so that when service.js starts up (which it does after 10s, thanks to Weave.js) it doesn't reset the WeaveID's username to ''.

This makes the tests pass again for me when running with the test coverage tool.
Attachment #457315 - Flags: review?(edilee)
Attachment #457315 - Flags: review?(edilee) → review+
http://hg.mozilla.org/services/fx-sync/rev/a2ad8a4d4824
Explicitly set username pref so that when service.js starts up (which it does after 10s, thanks to Weave.js) it doesn't reset the WeaveID's username to ''.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: 1.4 → 1.5
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: