https://codereview.appspot.com/14218044/diff/1/environs/simplestreams/simplestreams_test.go File environs/simplestreams/simplestreams_test.go (right):
https://codereview.appspot.com/14218044/diff/1/environs/simplestreams/simplestreams_test.go#newcode300 environs/simplestreams/simplestreams_test.go:300: Series: []string{"precise"}, // never match On 2013/10/02 04:02:00, thumper wrote: > What is the never match? precise or arm? Also, perhaps better to give a region > that doesn't exist? Someone may add arm at some stage. Would that work?
precise, which isn't in the daily stream I added to testing. I can't use a non-existent region, as that causes GetMetadata to error, which we don't want.
The series are validated, but architectures aren't. I'll put in an invalid arch.
https://codereview.appspot.com/14218044/diff/1/environs/simplestreams/simplestreams_test.go#newcode326 environs/simplestreams/simplestreams_test.go:326: messages = append(messages, messages...) On 2013/10/02 04:02:00, thumper wrote: > I agree with our IRC chat, ideally we would have a simple mock datasource. What > about...
> type countingSource struct { > simplestreams.DataSource > count int > }
> func (s *countingSource) URL(path string) (string, error) { > s.count++ > return s.DataSource.URL(path) > }
> Then have sources defined by:
> first :=
&countingSource{DataSource:simplestreams.NewURLDataSource("test:/daily", > simplestreams.VerifySSLHostnames)} > second :=
&countingSource{DataSource:simplestreams.NewURLDataSource("test:/daily", > simplestreams.VerifySSLHostnames)} > sources := []simplestream.DataSource{first, second}
> // do stuff
> c.Check(first.count, gc.Equals, 1) > c.Check(second.count, gc.Equals, 1)
Done, tho I'm reusing a single countingSource.
https://codereview.appspot.com/14218044/
« Back to merge proposal
https:/ /codereview. appspot. com/14218044/ diff/1/ environs/ simplestreams/ simplestreams_ test.go simplestreams/ simplestreams_ test.go (right):
File environs/
https:/ /codereview. appspot. com/14218044/ diff/1/ environs/ simplestreams/ simplestreams_ test.go# newcode300 simplestreams/ simplestreams_ test.go: 300: Series: "precise" }, // never match
environs/
[]string{
On 2013/10/02 04:02:00, thumper wrote:
> What is the never match? precise or arm? Also, perhaps better to give
a region
> that doesn't exist? Someone may add arm at some stage. Would that
work?
precise, which isn't in the daily stream I added to testing. I can't use
a non-existent region, as that causes GetMetadata to error, which we
don't want.
The series are validated, but architectures aren't. I'll put in an
invalid arch.
https:/ /codereview. appspot. com/14218044/ diff/1/ environs/ simplestreams/ simplestreams_ test.go# newcode326 simplestreams/ simplestreams_ test.go: 326: messages =
environs/
append(messages, messages...)
On 2013/10/02 04:02:00, thumper wrote:
> I agree with our IRC chat, ideally we would have a simple mock
datasource. What
> about...
> type countingSource struct { DataSource
> simplestreams.
> count int
> }
> func (s *countingSource) URL(path string) (string, error) { URL(path)
> s.count++
> return s.DataSource.
> }
> Then have sources defined by:
> first :=
&countingSource {DataSource: simplestreams. NewURLDataSourc e("test: /daily" , VerifySSLHostna mes)}
> simplestreams.
> second :=
&countingSource {DataSource: simplestreams. NewURLDataSourc e("test: /daily" , VerifySSLHostna mes)} DataSource{ first, second}
> simplestreams.
> sources := []simplestream.
> // do stuff
> c.Check( first.count, gc.Equals, 1) second. count, gc.Equals, 1)
> c.Check(
Done, tho I'm reusing a single countingSource.
https:/ /codereview. appspot. com/14218044/