Merge lp:~sinzui/juju-core/backport-underscores into lp:juju-core/1.16

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 1976
Proposed branch: lp:~sinzui/juju-core/backport-underscores
Merge into: lp:juju-core/1.16
Diff against target: 32 lines (+10/-1)
2 files modified
names/relation.go (+1/-1)
names/relation_test.go (+9/-0)
To merge this branch: bzr merge lp:~sinzui/juju-core/backport-underscores
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+192937@code.launchpad.net

Commit message

Backport underscores in relation name fix.

Description of the change

Backport underscores in relation name fix.

Relation names can have underscores.

https://codereview.appspot.com/18640043/

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Reviewers: mp+192937_code.launchpad.net,

Message:
Please take a look.

Description:
Backport underscores in relation name fix.

Relation names can have underscores.

https://code.launchpad.net/~sinzui/juju-core/backport-underscores/+merge/192937

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/18640043/

Affected files (+12, -1 lines):
   A [revision details]
   M names/relation.go
   M names/relation_test.go

Index: [revision details]
=== 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-20131017110030-3qkmwi95yqtlclze
+New revision: <email address hidden>

Index: names/relation.go
=== modified file 'names/relation.go'
--- names/relation.go 2013-09-11 10:23:23 +0000
+++ names/relation.go 2013-10-28 19:07:21 +0000
@@ -9,7 +9,7 @@
   "strings"
  )

-const RelationSnippet = "[a-z][a-z0-9]*(-[a-z0-9]+)*"
+const RelationSnippet = "[a-z][a-z0-9]*([_-][a-z0-9]+)*"

  // Relation keys have the format "service1:relName1 service2:relName2".
  // Except the peer relations, which have the format "service:relName"

Index: names/relation_test.go
=== modified file 'names/relation_test.go'
--- names/relation_test.go 2013-09-11 11:21:28 +0000
+++ names/relation_test.go 2013-10-28 19:07:21 +0000
@@ -33,6 +33,15 @@
   {pattern: "42also-not", valid: false},
   {pattern: "042", valid: false},
   {pattern: "0x42", valid: false},
+ {pattern: "foo_42", valid: true},
+ {pattern: "_foo", valid: false},
+ {pattern: "!foo", valid: false},
+ {pattern: "foo_bar-baz_boo", valid: true},
+ {pattern: "foo bar", valid: false},
+ {pattern: "foo-_", valid: false},
+ {pattern: "foo-", valid: false},
+ {pattern: "foo_-a", valid: false},
+ {pattern: "foo_", valid: false},
  }

  func (s *relationSuite) TestRelationKeyFormats(c *gc.C) {

Revision history for this message
Nate Finch (natefinch) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'names/relation.go'
2--- names/relation.go 2013-09-11 10:23:23 +0000
3+++ names/relation.go 2013-10-28 19:18:49 +0000
4@@ -9,7 +9,7 @@
5 "strings"
6 )
7
8-const RelationSnippet = "[a-z][a-z0-9]*(-[a-z0-9]+)*"
9+const RelationSnippet = "[a-z][a-z0-9]*([_-][a-z0-9]+)*"
10
11 // Relation keys have the format "service1:relName1 service2:relName2".
12 // Except the peer relations, which have the format "service:relName"
13
14=== modified file 'names/relation_test.go'
15--- names/relation_test.go 2013-09-11 11:21:28 +0000
16+++ names/relation_test.go 2013-10-28 19:18:49 +0000
17@@ -33,6 +33,15 @@
18 {pattern: "42also-not", valid: false},
19 {pattern: "042", valid: false},
20 {pattern: "0x42", valid: false},
21+ {pattern: "foo_42", valid: true},
22+ {pattern: "_foo", valid: false},
23+ {pattern: "!foo", valid: false},
24+ {pattern: "foo_bar-baz_boo", valid: true},
25+ {pattern: "foo bar", valid: false},
26+ {pattern: "foo-_", valid: false},
27+ {pattern: "foo-", valid: false},
28+ {pattern: "foo_-a", valid: false},
29+ {pattern: "foo_", valid: false},
30 }
31
32 func (s *relationSuite) TestRelationKeyFormats(c *gc.C) {

Subscribers

People subscribed via source and target branches

to all changes: