From 87c90eb9244f0b179f15200b94bb25544795ccb3 Mon Sep 17 00:00:00 2001 From: Fabrice Matrat Date: Mon, 25 Jan 2016 10:11:44 +0100 Subject: [PATCH] Add test dfor series. --- internal/series/series.go | 44 +++++++++++++++++++-------------------- internal/v5/api_test.go | 17 +++++++++++++++ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/internal/series/series.go b/internal/series/series.go index 89bb4c2be..26a1f54d6 100644 --- a/internal/series/series.go +++ b/internal/series/series.go @@ -36,32 +36,32 @@ type SeriesInfo struct { // Series contains the data charmstore knows about series names var Series = map[string]SeriesInfo{ // Bundle - "bundle": SeriesInfo{false, "", true, 1.1255}, + "bundle": {false, "", true, 1.1255}, // Ubuntu - "oneiric": SeriesInfo{true, Ubuntu, false, 0}, - "precise": SeriesInfo{true, Ubuntu, true, 1.1125}, - "quantal": SeriesInfo{true, Ubuntu, false, 0}, - "raring": SeriesInfo{true, Ubuntu, false, 0}, - "saucy": SeriesInfo{true, Ubuntu, false, 0}, - "trusty": SeriesInfo{true, Ubuntu, true, 1.125}, - "utopic": SeriesInfo{true, Ubuntu, false, 0}, - "vivid": SeriesInfo{true, Ubuntu, true, 1.101}, - "wily": SeriesInfo{true, Ubuntu, true, 1.102}, - "xenial": SeriesInfo{true, Ubuntu, true, 1.103}, + "oneiric": {true, Ubuntu, false, 0}, + "precise": {true, Ubuntu, true, 1.1125}, + "quantal": {true, Ubuntu, false, 0}, + "raring": {true, Ubuntu, false, 0}, + "saucy": {true, Ubuntu, false, 0}, + "trusty": {true, Ubuntu, true, 1.125}, + "utopic": {true, Ubuntu, false, 0}, + "vivid": {true, Ubuntu, true, 1.101}, + "wily": {true, Ubuntu, true, 1.102}, + "xenial": {true, Ubuntu, true, 1.103}, // Windows - "win2012hvr2": SeriesInfo{true, Windows, true, 1.1}, - "win2012hv": SeriesInfo{true, Windows, true, 1.1}, - "win2012r2": SeriesInfo{true, Windows, true, 1.1}, - "win2012": SeriesInfo{true, Windows, true, 1.1}, - "win7": SeriesInfo{true, Windows, true, 1.1}, - "win8": SeriesInfo{true, Windows, true, 1.1}, - "win81": SeriesInfo{true, Windows, true, 1.1}, - "win10": SeriesInfo{true, Windows, true, 1.1}, - "win2016": SeriesInfo{true, Windows, true, 1.1}, - "win2016nano": SeriesInfo{true, Windows, true, 1.1}, + "win2012hvr2": {true, Windows, true, 1.1}, + "win2012hv": {true, Windows, true, 1.1}, + "win2012r2": {true, Windows, true, 1.1}, + "win2012": {true, Windows, true, 1.1}, + "win7": {true, Windows, true, 1.1}, + "win8": {true, Windows, true, 1.1}, + "win81": {true, Windows, true, 1.1}, + "win10": {true, Windows, true, 1.1}, + "win2016": {true, Windows, true, 1.1}, + "win2016nano": {true, Windows, true, 1.1}, // Centos - "centos7": SeriesInfo{true, CentOS, true, 1.1}, + "centos7": {true, CentOS, true, 1.1}, } diff --git a/internal/v5/api_test.go b/internal/v5/api_test.go index cf03d10c9..c984a0c8c 100644 --- a/internal/v5/api_test.go +++ b/internal/v5/api_test.go @@ -37,6 +37,7 @@ import ( "gopkg.in/juju/charmstore.v5-unstable/internal/entitycache" "gopkg.in/juju/charmstore.v5-unstable/internal/mongodoc" "gopkg.in/juju/charmstore.v5-unstable/internal/router" + "gopkg.in/juju/charmstore.v5-unstable/internal/series" "gopkg.in/juju/charmstore.v5-unstable/internal/storetesting" "gopkg.in/juju/charmstore.v5-unstable/internal/storetesting/hashtesting" "gopkg.in/juju/charmstore.v5-unstable/internal/v5" @@ -896,6 +897,22 @@ func (s *APISuite) TestMetaTermsBundle(c *gc.C) { }) } +func (s *APISuite) TestSeries(c *gc.C) { + for k := range series.Series { + if k == "bundle" { + continue + } + id := k + "/wordpress-23" + s.addPublicCharm(c, "wordpress", newResolvedURL("~charmers/"+id, 23)) + s.assertGet(c, id+"/meta/id", map[string]interface{}{ + "Id": "cs:" + k + "/wordpress-23", + "Series": k, + "Name": "wordpress", + "Revision": 23, + }) + } +} + func (s *APISuite) TestExtraInfo(c *gc.C) { id := "precise/wordpress-23" s.addPublicCharm(c, "wordpress", newResolvedURL("~charmers/"+id, 23))