~james-page/ubuntu/wily/juju-core/mir-fixes

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/testing/charm.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-03-28 08:58:42 UTC
  • mfrom: (1.1.21)
  • Revision ID: package-import@ubuntu.com-20140328085842-cyzrgc120bdfxwj0
Tags: 1.17.7-0ubuntu1
* New upstream point release, including fixes for:
  - no debug log with all providers on Ubuntu 14.04 (LP: #1294776).
* d/control: Add cpu-checker dependency to juju-local (LP: #1297077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        }
97
97
        clone(dst, r.DirPath(name))
98
98
        return &charm.URL{
99
 
                Schema:   "local",
100
 
                Series:   series,
101
 
                Name:     name,
102
 
                Revision: -1,
 
99
                Reference: charm.Reference{
 
100
                        Schema:   "local",
 
101
                        Name:     name,
 
102
                        Revision: -1,
 
103
                },
 
104
                Series: series,
103
105
        }
104
106
}
105
107
 
126
128
// MockCharmStore implements charm.Repository and is used to isolate tests
127
129
// that would otherwise need to hit the real charm store.
128
130
type MockCharmStore struct {
129
 
        charms    map[string]map[int]*charm.Bundle
130
 
        AuthAttrs string
131
 
        TestMode  bool
 
131
        charms        map[string]map[int]*charm.Bundle
 
132
        AuthAttrs     string
 
133
        TestMode      bool
 
134
        DefaultSeries string
132
135
}
133
136
 
134
137
func NewMockCharmStore() *MockCharmStore {
145
148
        return s
146
149
}
147
150
 
 
151
func (s *MockCharmStore) WithDefaultSeries(series string) charm.Repository {
 
152
        s.DefaultSeries = series
 
153
        return s
 
154
}
 
155
 
 
156
func (s *MockCharmStore) Resolve(ref charm.Reference) (*charm.URL, error) {
 
157
        if s.DefaultSeries == "" {
 
158
                return nil, fmt.Errorf("missing default series, cannot resolve charm url: %q", ref)
 
159
        }
 
160
        return &charm.URL{Reference: ref, Series: s.DefaultSeries}, nil
 
161
}
 
162
 
148
163
// SetCharm adds and removes charms in s. The affected charm is identified by
149
164
// charmURL, which must be revisioned. If bundle is nil, the charm will be
150
165
// removed; otherwise, it will be stored. It is an error to store a bundle