Skip to content

Commit

Permalink
Migrate to charm.v6-unstable and macaroon-bakery.v1.
Browse files Browse the repository at this point in the history
Conflicts:
	testing/base_unix.go
  • Loading branch information
frankban authored and rogpeppe committed Sep 14, 2015
1 parent ccec3da commit b668aa0
Show file tree
Hide file tree
Showing 232 changed files with 458 additions and 391 deletions.
2 changes: 1 addition & 1 deletion api/action/client.go
Expand Up @@ -5,7 +5,7 @@ package action

import (
"github.com/juju/errors"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/action/client_test.go
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/action"
"github.com/juju/juju/apiserver/params"
Expand Down
3 changes: 1 addition & 2 deletions api/apiclient_test.go
Expand Up @@ -10,12 +10,11 @@ import (
"net"
"strconv"

"golang.org/x/net/websocket"

"github.com/juju/names"
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
"github.com/juju/utils/parallel"
"golang.org/x/net/websocket"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api"
Expand Down
4 changes: 2 additions & 2 deletions api/base/testing/apicaller.go
Expand Up @@ -4,12 +4,12 @@
package testing

import (
"github.com/juju/names"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api/base"
"github.com/juju/names"
"github.com/juju/testing"
)

// APICallerFunc is a function type that implements APICaller.
Expand Down
2 changes: 1 addition & 1 deletion api/charmrevisionupdater/updater_test.go
Expand Up @@ -7,7 +7,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/charmrevisionupdater"
"github.com/juju/juju/apiserver/charmrevisionupdater/testing"
Expand Down
2 changes: 1 addition & 1 deletion api/charms/client.go
Expand Up @@ -5,7 +5,7 @@ package charms

import (
"github.com/juju/errors"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/client.go
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/juju/names"
"github.com/juju/utils"
"golang.org/x/net/websocket"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/macaroon.v1"

"github.com/juju/juju/api/base"
Expand Down
2 changes: 1 addition & 1 deletion api/client_test.go
Expand Up @@ -22,7 +22,7 @@ import (
jc "github.com/juju/testing/checkers"
"golang.org/x/net/websocket"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/charm.go
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"

"github.com/juju/errors"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/apiserver/params"
)
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/endpoint.go
Expand Up @@ -4,7 +4,7 @@
package uniter

import (
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"
)

// Endpoint represents one endpoint of a relation. It is just a wrapper
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/relation_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/uniter"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/relationunit_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/uniter"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/service.go
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/common"
"github.com/juju/juju/api/watcher"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/unit.go
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/common"
"github.com/juju/juju/api/watcher"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/unit_test.go
Expand Up @@ -12,7 +12,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/api/base"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/uniter.go
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/api/common"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/action/action_test.go
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/apiserver/action"
"github.com/juju/juju/apiserver/common"
Expand Down
1 change: 1 addition & 0 deletions apiserver/addresser/addresser_test.go
Expand Up @@ -5,6 +5,7 @@ package addresser_test

import (
"github.com/juju/errors"

jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

Expand Down
3 changes: 1 addition & 2 deletions apiserver/addresser/mock_test.go
Expand Up @@ -7,12 +7,11 @@ import (
"sort"
"sync"

gc "gopkg.in/check.v1"

"github.com/juju/errors"
"github.com/juju/names"
"github.com/juju/testing"
jujutxn "github.com/juju/txn"
gc "gopkg.in/check.v1"

"github.com/juju/juju/apiserver/addresser"
"github.com/juju/juju/environs"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/adminv2_test.go
Expand Up @@ -4,11 +4,11 @@
package apiserver_test

import (
"github.com/juju/juju/api"
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver"
"github.com/juju/juju/testing/factory"
)
Expand Down
49 changes: 30 additions & 19 deletions apiserver/charmrevisionupdater/testing/suite.go
Expand Up @@ -5,13 +5,14 @@ package testing

import (
"fmt"
"net/http/httptest"

jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v5/charmrepo"
"gopkg.in/juju/charmstore.v4"
"gopkg.in/juju/charmstore.v4/charmstoretesting"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/charmrepo.v1"
"gopkg.in/juju/charmrepo.v1/csclient"
"gopkg.in/juju/charmstore.v5-unstable"

"github.com/juju/juju/apiserver/charmrevisionupdater"
jujutesting "github.com/juju/juju/juju/testing"
Expand All @@ -25,8 +26,10 @@ import (
type CharmSuite struct {
jcSuite *jujutesting.JujuConnSuite

Server *charmstoretesting.Server
charms map[string]*state.Charm
Handler charmstore.HTTPCloseHandler
Server *httptest.Server
Client *csclient.Client
charms map[string]*state.Charm
}

func (s *CharmSuite) SetUpSuite(c *gc.C, jcSuite *jujutesting.JujuConnSuite) {
Expand All @@ -36,33 +39,42 @@ func (s *CharmSuite) SetUpSuite(c *gc.C, jcSuite *jujutesting.JujuConnSuite) {
func (s *CharmSuite) TearDownSuite(c *gc.C) {}

func (s *CharmSuite) SetUpTest(c *gc.C) {
s.Server = charmstoretesting.OpenServer(c, s.jcSuite.Session, charmstore.ServerParams{
db := s.jcSuite.Session.DB("juju-testing")
params := charmstore.ServerParams{
AuthUsername: "test-user",
AuthPassword: "test-password",
}
handler, err := charmstore.NewServer(db, nil, "", params, charmstore.V4)
c.Assert(err, jc.ErrorIsNil)
s.Handler = handler
s.Server = httptest.NewServer(handler)
s.Client = csclient.New(csclient.Params{
URL: s.Server.URL,
User: params.AuthUsername,
Password: params.AuthPassword,
})
urls := []string{
"~who/quantal/mysql-23",
"~who/quantal/dummy-24",
"~who/quantal/riak-25",
"~who/quantal/wordpress-26",
"~who/quantal/logging-27",
urls := map[string]string{
"mysql": "quantal/mysql-23",
"dummy": "quantal/dummy-24",
"riak": "quantal/riak-25",
"wordpress": "quantal/wordpress-26",
"logging": "quantal/logging-27",
}
for _, url := range urls {
id := charm.MustParseReference(url)
ch := testcharms.Repo.CharmArchive(c.MkDir(), id.Name)
s.Server.UploadCharm(c, ch, id, true)
for name, url := range urls {
testcharms.UploadCharm(c, s.Client, url, name)
}
s.jcSuite.PatchValue(&charmrepo.CacheDir, c.MkDir())
// Patch the charm repo initializer function: it is replaced with a charm
// store repo pointing to the testing server.
s.jcSuite.PatchValue(&charmrevisionupdater.NewCharmStore, func(p charmrepo.NewCharmStoreParams) charmrepo.Interface {
p.URL = s.Server.URL()
p.URL = s.Server.URL
return charmrepo.NewCharmStore(p)
})
s.charms = make(map[string]*state.Charm)
}

func (s *CharmSuite) TearDownTest(c *gc.C) {
s.Handler.Close()
s.Server.Close()
}

Expand All @@ -79,7 +91,6 @@ func (s *CharmSuite) AddMachine(c *gc.C, machineId string, job state.MachineJob)
inst, hc := jujutesting.AssertStartInstanceWithConstraints(c, s.jcSuite.Environ, m.Id(), cons)
err = m.SetProvisioned(inst.Id(), "fake_nonce", hc)
c.Assert(err, jc.ErrorIsNil)

}

// AddCharmWithRevision adds a charm with the specified revision to state.
Expand Down
4 changes: 2 additions & 2 deletions apiserver/charmrevisionupdater/updater.go
Expand Up @@ -6,8 +6,8 @@ package charmrevisionupdater
import (
"github.com/juju/errors"
"github.com/juju/loggo"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v5/charmrepo"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/charmrepo.v1"

"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/params"
Expand Down
8 changes: 4 additions & 4 deletions apiserver/charmrevisionupdater/updater_test.go
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v5/charmrepo"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/charmrepo.v1"

"github.com/juju/juju/apiserver/charmrevisionupdater"
"github.com/juju/juju/apiserver/charmrevisionupdater/testing"
Expand Down Expand Up @@ -127,7 +127,7 @@ func (s *charmVersionSuite) TestWordpressCharmNoReadAccessIsntVisible(c *gc.C) {
s.SetupScenario(c)

// Disallow read access to the wordpress charm in the charm store.
err := s.Server.NewClient().Put("/quantal/wordpress/meta/perm/read", nil)
err := s.Client.Put("/quantal/wordpress/meta/perm/read", nil)
c.Assert(err, jc.ErrorIsNil)

// Run the revision updater and check that the public charm updates are
Expand Down Expand Up @@ -155,7 +155,7 @@ func (s *charmVersionSuite) TestEnvironmentUUIDUsed(c *gc.C) {
var header http.Header
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
header = r.Header
s.Server.Handler().ServeHTTP(w, r)
s.Handler.ServeHTTP(w, r)
}))
defer srv.Close()

Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms.go
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/juju/errors"
ziputil "github.com/juju/utils/zip"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

apihttp "github.com/juju/juju/apiserver/http"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms/client.go
Expand Up @@ -6,7 +6,7 @@ package charms
import (
"github.com/juju/errors"
"github.com/juju/utils/set"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/common"
Expand Down
6 changes: 3 additions & 3 deletions apiserver/charms/client_test.go
Expand Up @@ -6,7 +6,7 @@ package charms_test
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/charms"
Expand Down Expand Up @@ -97,14 +97,14 @@ func (s *baseCharmsSuite) TestClientCharmInfo(c *gc.C) {
charm: "wordpress",
expectedActions: &charm.Actions{ActionSpecs: nil},
url: "not-valid",
err: "charm url series is not resolved",
err: "entity url series is not resolved",
},
{
about: "invalid schema",
charm: "wordpress",
expectedActions: &charm.Actions{ActionSpecs: nil},
url: "not-valid:your-arguments",
err: `charm URL has invalid schema: "not-valid:your-arguments"`,
err: `entity URL has invalid schema: "not-valid:your-arguments"`,
},
{
about: "unknown charm",
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms/state.go
Expand Up @@ -4,7 +4,7 @@
package charms

import (
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/state"
)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms_test.go
Expand Up @@ -17,7 +17,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v5"
"gopkg.in/juju/charm.v6-unstable"

apihttp "github.com/juju/juju/apiserver/http"
"github.com/juju/juju/apiserver/params"
Expand Down

0 comments on commit b668aa0

Please sign in to comment.