Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…hard enumeration
  • Loading branch information...
commit 1680db67d26f2a41f98a72d8b248c5aa2c4fdb4b 1 parent cc1f3f1
@stuhood stuhood authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.