func (s *SimpleStreamsToolsSuite) TestFindToolsInControlBucket(c *gc.C) { s.reset(c, nil) custom := toolstesting.UploadToStorage(c, s.env.Storage(), envtesting.V110p...) s.uploadPublic(c, envtesting.VAll...) actual, err := envtools.FindTools(s.env, 1, 1, coretools.Filter{}, envtools.DoNotAllowRetry) c.Assert(err, gc.IsNil) expect := map[version.Binary]string{} for _, expected := range envtesting.V110p { expect[expected] = custom[expected] } c.Assert(actual.URLs(), gc.DeepEquals, expect) }
func (s *clientSuite) TestClientFindTools(c *gc.C) { result, err := s.APIState.Client().FindTools(99, -1, "", "") c.Assert(err, jc.ErrorIsNil) c.Assert(result.Error, jc.Satisfies, params.IsCodeNotFound) toolstesting.UploadToStorage(c, s.DefaultToolsStorage, "released", version.MustParseBinary("2.99.0-precise-amd64")) result, err = s.APIState.Client().FindTools(2, 99, "precise", "amd64") c.Assert(err, jc.ErrorIsNil) c.Assert(result.Error, gc.IsNil) c.Assert(result.List, gc.HasLen, 1) c.Assert(result.List[0].Version, gc.Equals, version.MustParseBinary("2.99.0-precise-amd64")) url := fmt.Sprintf("https://%s/model/%s/tools/%s", s.APIState.Addr(), coretesting.ModelTag.Id(), result.List[0].Version) c.Assert(result.List[0].URL, gc.Equals, url) }