Handle nil BundleData when unmarshalling from bson #211

Merged
merged 2 commits into from May 27, 2016

Conversation

Projects
None yet
3 participants
Owner

wallyworld commented May 27, 2016

A small fix for bson unmarshall to properly return SetZero when there's no data.

bundledata_test.go
+ var bd charm.BundleData
+ err := bd.SetBSON(bson.Raw{10, []byte(nil)})
+ c.Assert(err, gc.Equals, bson.SetZero)
+}
@axw

axw May 27, 2016

Member

Can you make the test more about the expected behaviour? The bson.SetZero malarkey is more about the bson internals, rather than what we expect of the de/serialisation.

i.e. marshal an empty BundleData, and unmarshal into a *BundleData and check that it's nil on the way back in.

@wallyworld

wallyworld May 27, 2016

Owner

Fair point, added better test

Member

axw commented May 27, 2016

LGTM with a higher-level test.

Owner

wallyworld commented May 27, 2016

$$merge$$

Contributor

jujubot commented May 27, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-charm

@jujubot jujubot merged commit 503191d into juju:v6-unstable May 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment