Merge lp:~cmars/juju-core/cs-resolve-notfound-fix into lp:~go-bot/juju-core/trunk
Proposed by
Casey Marshall
Status: | Merged |
---|---|
Approved by: | Casey Marshall |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2499 |
Proposed branch: | lp:~cmars/juju-core/cs-resolve-notfound-fix |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
150 lines (+78/-4) 4 files modified
store/server.go (+1/-1) store/server_test.go (+17/-0) store/store.go (+5/-3) store/store_test.go (+55/-0) |
To merge this branch: | bzr merge lp:~cmars/juju-core/cs-resolve-notfound-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+212991@code.launchpad.net |
Commit message
Fixed charm store series resolving issues.
Fixed an issue where trying to resolve series for a charm not found causes an
HTTP 502, needed a nil check.
Fixed an issue where the charm URL regex match for resolving series was
too greedy, causing it to fail to resolve mysql, for example.
Added test cases for the above.
Description of the change
Fixed charm store series resolving issues.
Fixed an issue where trying to resolve series for a charm not found causes an
HTTP 502, needed a nil check.
Fixed an issue where the charm URL regex match for resolving series was
too greedy, causing it to fail to resolve mysql, for example.
Added test cases for the above.
To post a comment you must log in.
Reviewers: mp+212991_ code.launchpad. net,
Message:
Please take a look.
Description:
Fixed charm store series resolving issues.
Fixed an issue where trying to resolve series for a charm not found
causes an
HTTP 502, needed a nil check.
Fixed an issue where the charm URL regex match for resolving series was
too greedy, causing it to fail to resolve mysql, for example.
Added test cases for the above.
https:/ /code.launchpad .net/~cmars/ juju-core/ cs-resolve- notfound- fix/+merge/ 212991
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/81250043/
Affected files (+80, -4 lines): test.go
A [revision details]
M store/server.go
M store/server_
M store/store.go
M store/store_test.go
Index: [revision details] 20140325164440- iqj920tnf1v754d w
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: store/server.go
=== modified file 'store/server.go'
--- store/server.go 2014-03-24 15:35:41 +0000
+++ store/server.go 2014-03-25 18:57:36 +0000
@@ -117,7 +117,7 @@
c.Revision = info.Revision()
c.Digest = info.Digest()
} else {
- if err == ErrNotFound {
+ if err == ErrNotFound && curl != nil {
skey = charmStatsKey(curl, "charm-missing")
}
c.Errors = append(c.Errors, err.Error())
Index: store/server_ test.go server_ test.go' test.go 2014-03-20 19:51:05 +0000 test.go 2014-03-27 05:00:05 +0000 erSum(c, []string{ "charm- event", "oneiric", "mysql"}, false,
=== modified file 'store/
--- store/server_
+++ store/server_
@@ -183,6 +183,23 @@
s.checkCount
1)
}
+func (s *StoreSuite) TestSeriesNotFo und(c *gc.C) { (s.store) ("GET", "/charm- info?charms= cs:not- found", nil) NewRecorder( ) ServeHTTP( rec, req) interface{ }{"cs:not- found": map[string] interface{ }{ }{"entry not found"}}} interface{ }{} (rec.Body) .Decode( &obtained)
+ server, err := store.NewServer
+ req, err := http.NewRequest
+ c.Assert(err, gc.IsNil)
+ rec := httptest.
+ server.
+ c.Assert(rec.Code, gc.Equals, http.StatusOK)
+
+ expected := map[string]
+ "revision": float64(0),
+ "errors": []interface{
+ obtained := map[string]
+ err = json.NewDecoder
+ c.Assert(err, gc.IsNil)
+ c.Assert(obtained, gc.DeepEquals, expected)
+}
+
// checkCounterSum checks that statistics are properly collected.
// It retries a few times as they are generally collected in background.
func (s *StoreSuite) checkCounterSum(c *gc.C, key []string, prefix bool,
expected int64) {
Index: store/store.go
=== modified file 'store/store.go'
--- store/store.go 2014-03-21 03:20:40 +0000
+++ store/store.go 2014-03-27 05:00:05 +0000
@@ -738,12 +738,12 @@
session := s.session.Copy()
defer session.Close()
- patternURL := &charm. URL{Reference: ref, Series: ".*"} URL{Reference: ref, Series: "[a-z][^/]+"} WithRevision( -1)
+ patternURL := &charm.
patternURL = patternURL.
charms := session.Charms() String( )}, String( ))},
q := charms.Find(bson.M{
- "urls": bson.RegEx{Pattern: patternURL.
+ "urls": bson.RegEx{Pattern: fmt.Sprintf("^%s$", patternURL.
...