Code review comment for lp:~axwalk/juju-core/lp1233924-simplestreams-getmetadata-fallback

Revision history for this message
Tim Penhey (thumper) wrote :

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