Browse files

Loosen validation even more, to check for only the existance of the s…

…hard enumeration
  • Loading branch information...
1 parent cc1f3f1 commit 1680db67d26f2a41f98a72d8b248c5aa2c4fdb4b @stuhood stuhood committed May 3, 2012
Showing with 4 additions and 2 deletions.
  1. +2 −2 lib/gizzard/thrift.rb
  2. +2 −0 test/nameserver_spec.rb
View
4 lib/gizzard/thrift.rb
@@ -32,10 +32,10 @@ def <=>(o)
alias_method :to_unix, :inspect
def self.parse(string)
- if groups = string.match(/(.*)\/(.*\d+_\d{3,}.*)/)
+ if groups = string.match(/(.*)\/(.*_\d{3,}.*)/)
new(*groups.values_at(1, 2))
else
- raise "Invalid shard id '#{string}': shard ids are composed of '<table-prefix>_<table-id>_<three-or-more-digit-id>[_<optional-suffix>]'"
+ raise "Invalid shard id '#{string}': shard ids are composed of '<table-prefix>_<three-or-more-digit-id>[_<optional-suffix>]'"
end
end
end
View
2 test/nameserver_spec.rb
@@ -17,6 +17,8 @@
parse_should("localhost", "edges_134_134_replicating")
parse_should("localhost", "writeonly_edges_backward_134_134")
parse_should("localhost", "writeonly_edges_forward_134_134")
+ parse_should("localhost", "status_1833_replicating")
+ parse_should("localhost", "status_1833")
end
def parse_should(hostname, table_prefix)

0 comments on commit 1680db6

Please sign in to comment.