Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12434 from SimonRichardson/charmhub-bundle-yaml
#12434 Charmhub API now exports bundle yaml for bundles rather than bulk loading them into metadata yaml. This is a good fix as it means bundles are not an after thought and it promotes bundles to first class entities. The change is simple it just expects the bundle-yaml json tag to be set along with the filters and passes them through the info. The charm facade can them check the type before performing the unmarshalling of the data correctly. ## QA steps ```sh $ export JUJU_DEV_FEATURE_FLAGS=charm-hub $ juju bootstrap lxd test $ juju add-model six --config charm-hub-url="https://api.staging.snapcraft.io" $ juju deploy wiki-simple ```
- Loading branch information
Showing
7 changed files
with
344 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2020 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package charms | ||
|
||
import ( | ||
jc "github.com/juju/testing/checkers" | ||
gc "gopkg.in/check.v1" | ||
|
||
"github.com/juju/juju/apiserver/params" | ||
"github.com/juju/juju/core/arch" | ||
) | ||
|
||
type clientNormalizeOriginSuite struct { | ||
} | ||
|
||
var _ = gc.Suite(&clientNormalizeOriginSuite{}) | ||
|
||
func (s *clientNormalizeOriginSuite) TestNormalizeCharmOriginNoAll(c *gc.C) { | ||
track := "1.0" | ||
origin := params.CharmOrigin{ | ||
Source: "charm-hub", | ||
Type: "charm", | ||
Risk: "edge", | ||
Track: &track, | ||
Architecture: "all", | ||
OS: "all", | ||
Series: "all", | ||
} | ||
obtained, err := normalizeCharmOrigin(origin) | ||
c.Assert(err, jc.ErrorIsNil) | ||
origin.Architecture = arch.DefaultArchitecture | ||
origin.OS = "" | ||
origin.Series = "" | ||
c.Assert(obtained, gc.DeepEquals, origin) | ||
} | ||
|
||
func (s *clientNormalizeOriginSuite) TestNormalizeCharmOriginLowerCase(c *gc.C) { | ||
track := "1.0" | ||
origin := params.CharmOrigin{ | ||
Source: "charm-hub", | ||
Type: "charm", | ||
Risk: "edge", | ||
Track: &track, | ||
Architecture: "s390", | ||
OS: "Ubuntu", | ||
Series: "focal", | ||
} | ||
obtained, err := normalizeCharmOrigin(origin) | ||
c.Assert(err, jc.ErrorIsNil) | ||
origin.OS = "ubuntu" | ||
c.Assert(obtained, gc.DeepEquals, origin) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.