Code review comment for lp://staging/~sinzui/juju-core/backport-underscores

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) {

« Back to merge proposal