Closed Bug 1224440 Opened 9 years ago Closed 9 years ago

TestSQLiteHistory.testUpgrades doesn't exercise upgrades from actual schema versions

Categories

(Firefox for iOS :: Data Storage, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rnewman, Assigned: rnewman)

References

Details

Attachments

(1 file)

This test uses the *current* BrowserTable code to construct each intermediate version, then exercises updates using the current update code.

That's wrong for a couple of major reasons.

Firstly, it requires that we maintain in the current product the code to construct every old version of the database schema.

Not only is this a little unreasonable -- table creation code must be maintained to create every version, and in theory we should test every one! -- but it's also very vulnerable to "paired bugs", where we're able to upgrade the version we create now, but not able to upgrade the version an old version of the app actually created.

Because we only test the creation code that's in the tree, we don't actually know if our upgrades work at all.

Secondly, it doesn't acknowledge that sqlite, SwiftData, iOS, or sqlcipher versions might change.


Fixing the second is hard; it would require shipping database files.

Fixing the first is a little easier: don't create the source tables using code in BrowserTable.
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Comment on attachment 8688540 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1273

Awesome...DB upgrades are scary business, so I feel more at ease knowing we have some tests. Seems like the maintenance to keep these tests updated could be annoying, but worth it.
Attachment #8688540 - Flags: review?(bnicholson) → review+
Comment on attachment 8688540 [details] [review]
Link to Github pull-request: https://github.com/mozilla/firefox-ios/pull/1273

Yup - really liking this snapshotting model of testing the upgrades!
Attachment #8688540 - Flags: review?(sleroux) → review+
With review comments addressed:

https://github.com/mozilla/firefox-ios/commit/1e57eac39b9488c3747a76dc63f8b0c58f74c007

We might consider uplifting this to 1.x.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0
Blocks: 1201110
Uplifted to v1.x:

5aca27f
Target Milestone: 2.0 → 1.3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: