MigrationExportSuite.TestUnits unequal results

Bug #1576704 reported by Curtis Hovey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Eric Snow

Bug Description

As seen in
    http://reports.vapour.ws/releases/issue/57236866749a5631dd9859a3

MigrationExportSuite.TestUnits unequal results in windows using go 1.6

migration_export_test.go:102:
    c.Check(st.Data(), jc.DeepEquals, map[string]interface{}{"index": i + 1})
... obtained map[string]interface {} = map[string]interface {}{"index":4}
... expected map[string]interface {} = map[string]interface {}{"index":1}
... mismatch at ["index"]: unequal; obtained 4; expected 1

migration_export_test.go:223:
    s.checkStatusHistory(c, history[:addedHistoryCount], status.StatusStarted)
migration_export_test.go:102:
    c.Check(st.Data(), jc.DeepEquals, map[string]interface{}{"index": i + 1})
... obtained map[string]interface {} = map[string]interface {}{"index":3}
... expected map[string]interface {} = map[string]interface {}{"index":2}
... mismatch at ["index"]: unequal; obtained 3; expected 2

migration_export_test.go:223:
    s.checkStatusHistory(c, history[:addedHistoryCount], status.StatusStarted)
migration_export_test.go:102:
    c.Check(st.Data(), jc.DeepEquals, map[string]interface{}{"index": i + 1})
... obtained map[string]interface {} = map[string]interface {}{"index":2}
... expected map[string]interface {} = map[string]interface {}{"index":3}
... mismatch at ["index"]: unequal; obtained 2; expected 3

migration_export_test.go:223:
    s.checkStatusHistory(c, history[:addedHistoryCount], status.StatusStarted)
migration_export_test.go:102:
    c.Check(st.Data(), jc.DeepEquals, map[string]interface{}{"index": i + 1})
... obtained map[string]interface {} = map[string]interface {}{"index":1}
... expected map[string]interface {} = map[string]interface {}{"index":4}
... mismatch at ["index"]: unequal; obtained 1; expected 4

The three failing tests are
    MigrationExportSuite.TestUnits
    MigrationExportSuite.TestMachines
    MigrationExportSuite.TestServices

Curtis Hovey (sinzui)
tags: added: regression
Curtis Hovey (sinzui)
description: updated
tags: added: blocker
Changed in juju-core:
assignee: nobody → Eric Snow (ericsnowcurrently)
status: Triaged → In Progress
Changed in juju-core:
assignee: Eric Snow (ericsnowcurrently) → Katherine Cox-Buday (cox-katherine-e)
Changed in juju-core:
assignee: Katherine Cox-Buday (cox-katherine-e) → Eric Snow (ericsnowcurrently)
Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

Thus far I see a number of possibilities here:

1. the timestamps on the status entries do not align with the order with which they were originally added by the test
2. mgo's Query.Sort() is not getting the order right
3. mgo's Query.Iter() is not preserving the order correctly
4. slice iteration is not preserving order correctly

None of those seem likely, so I'm probably missing something.

Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

This may be an issue of clock resolution on Windows (15.6 ms by default). It's very likely that some or all of the status history additions happen within the same clock tick, meaning that any sorting on the timestamp (which is what we do) is unreliably ordered.

Assuming this analysis is correct, we can resolve this through tiny sleeps or through using testing.Clock. Since we want the actual status history to have the correct order, fixing just the tests probably isn' t good enough.

Changed in juju-core:
importance: High → Critical
Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

Here's a patch that should fix this if it is related to Windows clock resolution.

http://reviews.vapour.ws/r/4746/

Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

The patch merged but I'm going to wait for the Windows tests to run before marking this bug as fix-committed.

Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

Per "run-unit-tests-win2012-amd64" on http://reports.vapour.ws/releases/3939, this has been resolved.

Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta7 → none
milestone: none → 2.0-beta7
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.