[ARVADOS] updated: a0ce38b05f3392ad238d8a3b5049de9edbf4985f
git at public.curoverse.com
git at public.curoverse.com
Thu Jun 11 16:11:59 EDT 2015
Summary of changes:
sdk/ruby/lib/arvados/keep.rb | 11 +++++++----
sdk/ruby/test/test_keep_manifest.rb | 17 +++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
via a0ce38b05f3392ad238d8a3b5049de9edbf4985f (commit)
from 0c082b748011ee94679204056cb52c145af35b08 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a0ce38b05f3392ad238d8a3b5049de9edbf4985f
Author: radhika <radhika at curoverse.com>
Date: Thu Jun 11 16:11:28 2015 -0400
6277: improve error message for missing file tokens.
diff --git a/sdk/ruby/lib/arvados/keep.rb b/sdk/ruby/lib/arvados/keep.rb
index 393266f..2006d33 100644
--- a/sdk/ruby/lib/arvados/keep.rb
+++ b/sdk/ruby/lib/arvados/keep.rb
@@ -241,7 +241,7 @@ module Keep
count = 0
word = words.shift
count += 1 if word =~ STREAM_REGEXP
- raise ArgumentError.new "Manifest invalid for stream #{line_count}. Missing or invalid stream name #{word}" if count != 1
+ raise ArgumentError.new "Manifest invalid for stream #{line_count}: missing or invalid stream name #{word.inspect}" if count != 1
count = 0
word = words.shift
@@ -249,15 +249,18 @@ module Keep
word = words.shift
count += 1
end
- raise ArgumentError.new "Manifest invalid for stream #{line_count}. Missing or invalid locator #{word}" if count == 0
+ raise ArgumentError.new "Manifest invalid for stream #{line_count}: missing or invalid locator #{word.inspect}" if count == 0
count = 0
while word =~ FILE_REGEXP
word = words.shift
count += 1
end
- if(count == 0) or (word and word !~ FILE_REGEXP)
- raise ArgumentError.new "Manifest invalid for stream #{line_count}. Missing or invalid file name #{word}"
+
+ if word
+ raise ArgumentError.new "Manifest invalid for stream #{line_count}: invalid file token #{word.inspect}"
+ elsif count == 0
+ raise ArgumentError.new "Manifest invalid for stream #{line_count}: no file tokens"
end
end
end
diff --git a/sdk/ruby/test/test_keep_manifest.rb b/sdk/ruby/test/test_keep_manifest.rb
index c49bd94..08965fa 100644
--- a/sdk/ruby/test/test_keep_manifest.rb
+++ b/sdk/ruby/test/test_keep_manifest.rb
@@ -281,22 +281,23 @@ class ManifestTest < Minitest::Test
end
[
- [false, 'abc d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt', 'invalid stream name abc'],
- [false, 'd41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt', 'invalid stream name d41d8cd98f00b204e9800998ecf8427e'],
- [false, '. d41d8cd98f00b204e9800998ecf8427 0:0:abc.txt', 'invalid locator d41d8cd98f00b204e9800998ecf8427'],
+ [false, 'abc d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt', "invalid stream name \"abc\""],
+ [false, 'd41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt', "invalid stream name \"d41d8cd98f00b204e9800998ecf8427e+0\""],
+ [false, '. d41d8cd98f00b204e9800998ecf8427 0:0:abc.txt', "invalid locator \"d41d8cd98f00b204e9800998ecf8427\""],
+ [false, '. d41d8cd98f00b204e9800998ecf8427e', "Manifest invalid for stream 1: no file tokens"],
[true, '. d41d8cd98f00b204e9800998ecf8427e 0:0:abc.txt'],
[true, '. d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt'],
[true, '. d41d8cd98f00b204e9800998ecf8427e a41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt'], # 2 locators
[false, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n/dir1 d41d8cd98f00b204e9800998ecf842 0:0:abc.txt",
- 'Manifest invalid for stream 2. Missing or invalid stream name /dir1'],
+ "Manifest invalid for stream 2: missing or invalid stream name \"/dir1\""],
[false, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n./dir1 d41d8cd98f00b204e9800998ecf842 0:0:abc.txt",
- 'Manifest invalid for stream 2. Missing or invalid locator d41d8cd98f00b204e9800998ecf842'],
+ "Manifest invalid for stream 2: missing or invalid locator \"d41d8cd98f00b204e9800998ecf842\""],
[false, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n./dir1 a41d8cd98f00b204e9800998ecf8427e+0 abc.txt",
- 'Manifest invalid for stream 2. Missing or invalid file name abc.txt'],
+ "Manifest invalid for stream 2: invalid file token \"abc.txt\""],
[false, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n./dir1 a41d8cd98f00b204e9800998ecf8427e+0 0:abc.txt",
- 'Manifest invalid for stream 2. Missing or invalid file name 0:abc.txt'],
+ "Manifest invalid for stream 2: invalid file token \"0:abc.txt\""],
[false, ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt\n./dir1 a41d8cd98f00b204e9800998ecf8427e+0 0:0:abc.txt xyz.txt",
- 'Manifest invalid for stream 2. Missing or invalid file name xyz.txt'],
+ "Manifest invalid for stream 2: invalid file token \"xyz.txt\""],
].each do |ok, manifest, expected_error=nil|
define_method "test_manifest_valid_#{ok}_#{manifest}_and_expect_error_#{expected_error}" do
if ok
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list