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 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?
https://codereview.appspot.com/14218044/diff/1/environs/simplestreams/simplestreams_test.go#newcode326 environs/simplestreams/simplestreams_test.go:326: messages = append(messages, messages...) 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)
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{
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?
https:/ /codereview. appspot. com/14218044/ diff/1/ environs/ simplestreams/ simplestreams_ test.go# newcode326 simplestreams/ simplestreams_ test.go: 326: messages =
environs/
append(messages, messages...)
I agree with our IRC chat, ideally we would have a simple mock
datasource. What about...
type countingSource struct { s.DataSource
simplestream
count int
}
func (s *countingSource) URL(path string) (string, error) { URL(path)
s.count++
return s.DataSource.
}
Then have sources defined by:
first := {DataSource: simplestreams. NewURLDataSourc e("test: /daily" , VerifySSLHostna mes)} {DataSource: simplestreams. NewURLDataSourc e("test: /daily" , VerifySSLHostna mes)} DataSource{ first, second}
&countingSource
simplestreams.
second :=
&countingSource
simplestreams.
sources := []simplestream.
// do stuff
c.Check( first.count, gc.Equals, 1) second. count, gc.Equals, 1)
c.Check(
https:/ /codereview. appspot. com/14218044/