I'm very confused about this error: jc.DeepEquals
roger peppe
rogpeppe at gmail.com
Tue Jul 7 02:29:16 UTC 2015
On 6 July 2015 at 03:23, John Meinel <john at arbash-meinel.com> wrote:
> Is it possible the data is accidentally mutable and being updated
> asynchronously? Such that at the time the initial comparison is made the
> value is actually false, but by the time we notice the mismatch and report
> on it the data has been updated and they are now the same?
I think this is almost certainly what is happening.
It doesn't even have to be a race - here's an example:
http://play.golang.org/p/KMCW6q9mwy
This wasn't something I considered when writing that
part of jc.DeepEquals! Nice find.
It should probably manufacture the error message at the time
of generation, or else copy the values. There's still the possibility
of a race then, of course, but it's considerably smaller.
cheers,
rog.
> Bad test to share
> mutable state between threads/goroutines, though it might be uncovering a
> deeper shared state problem?
>
> Or its just something equally weird where we get NaN != NaN, but true !=
> true would certainly be very odd.
>
> John
> =:->
>
>
> On Mon, Jul 6, 2015 at 3:35 AM, Tim Penhey <tim.penhey at canonical.com> wrote:
>>
>> This morning I noticed a Curse on the jes-cli branch, which included
>> this one on ppc64el:
>>
>>
>> http://reports.vapour.ws/releases/2855/job/run-unit-tests-trusty-ppc64el/attempt/3487
>>
>>
>> Upon looking I saw this:
>>
>> storage_test.go:147:
>> c.Assert(info, jc.DeepEquals, expect)
>> ... obtained state.FilesystemAttachmentInfo =
>> state.FilesystemAttachmentInfo{MountPoint:"", ReadOnly:true}
>> ... expected state.FilesystemAttachmentInfo =
>> state.FilesystemAttachmentInfo{MountPoint:"", ReadOnly:true}
>> ... mismatch at .ReadOnly: unequal; obtained true; expected true
>>
>>
>> um... wat?
>>
>> from state/filesystem.go:
>>
>> type FilesystemAttachmentInfo struct {
>> // MountPoint is the path at which the filesystem is mounted on
>> the
>> // machine. MountPoint may be empty, meaning that the filesystem
>> is
>> // not mounted yet.
>> MountPoint string `bson:"mountpoint"`
>> ReadOnly bool `bson:"read-only"`
>> }
>>
>>
>> So we have a plain struct with a string and a bool. How can
>> jc.DeepEquals fail with this?
>>
>> Confusedly yours,
>> Tim
>>
>> --
>> Juju-dev mailing list
>> Juju-dev at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
>
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
More information about the Juju-dev
mailing list