[ARVADOS] updated: 381951637e6688e1868fae9b0642411f5cd1c223

git at public.curoverse.com git at public.curoverse.com
Tue Aug 18 00:34:57 EDT 2015


Summary of changes:
 docker/workbench/application.yml.in               |  3 ++-
 sdk/python/arvados/commands/arv_copy.py           |  5 ++--
 services/api/lib/salvage_collection.rb            |  7 ++++-
 services/api/test/unit/salvage_collection_test.rb | 32 +++++++++++------------
 4 files changed, 27 insertions(+), 20 deletions(-)

       via  381951637e6688e1868fae9b0642411f5cd1c223 (commit)
       via  65f76d01b775c944d2ef6c1673633adb6229d9d8 (commit)
       via  45fcd8aeec29e7e3b86415811f2cf2a5beb82a54 (commit)
       via  d929be450d1886ac04d7c2c98cd16eb44f468413 (commit)
      from  21f6342de550d985db7e2d6964af2ad0f8405406 (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 381951637e6688e1868fae9b0642411f5cd1c223
Author: radhika <radhika at curoverse.com>
Date:   Tue Aug 18 00:29:24 2015 -0400

    6859: mocking Kernel system method had the undersirable side effect of impacting any and all invocations of this method resulting in failures in other tests. Hence, refactored the arv-put invocation into a separate method and mocked this instead in the test. All tests pass now.

diff --git a/services/api/lib/salvage_collection.rb b/services/api/lib/salvage_collection.rb
index 80b96b8..8854cb7 100755
--- a/services/api/lib/salvage_collection.rb
+++ b/services/api/lib/salvage_collection.rb
@@ -15,6 +15,10 @@ module SalvageCollection
   require 'tempfile'
   require 'shellwords'
 
+  def self.salvage_collection_arv_put temp_file
+    %x(arv-put --as-stream --use-filename invalid_manifest_text.txt #{Shellwords::shellescape(temp_file.path)})
+  end
+
   def self.salvage_collection uuid, reason='salvaged - see #6277, #6859'
     act_as_system_user do
       if !ENV['ARVADOS_API_TOKEN'].present? or !ENV['ARVADOS_API_HOST'].present?
@@ -53,7 +57,8 @@ module SalvageCollection
         temp_file = Tempfile.new('temp')
         temp_file.write(src_manifest)
         temp_file.close
-        new_manifest = %x(arv-put --as-stream --use-filename invalid_manifest_text.txt #{Shellwords::shellescape(temp_file.path)})
+
+        new_manifest = salvage_collection_arv_put temp_file
 
         temp_file.unlink
 
diff --git a/services/api/test/unit/salvage_collection_test.rb b/services/api/test/unit/salvage_collection_test.rb
index 3efe037..83f3c5b 100644
--- a/services/api/test/unit/salvage_collection_test.rb
+++ b/services/api/test/unit/salvage_collection_test.rb
@@ -4,26 +4,26 @@ require 'salvage_collection'
 TEST_MANIFEST = ". 341dabea2bd78ad0d6fc3f5b926b450e+85626+Ad391622a17f61e4a254eda85d1ca751c4f368da9 at 55e076ce 0:85626:brca2-hg19.fa\n. d7321a918923627c972d8f8080c07d29+82570+A22e0a1d9b9bc85c848379d98bedc64238b0b1532 at 55e076ce 0:82570:brca1-hg19.fa\n"
 
 module Kernel
-  def `(cmd)    # override kernel ` method
-    if cmd.include? 'arv-put'
-      file_contents = file = File.new(cmd.split[-1], "r").gets
-
-      # simulate arv-put error when it is 'user_agreement'
-      if file_contents.include? 'GNU_General_Public_License'
-        return ''
-      else
-        ". " +
-        Digest::MD5.hexdigest(TEST_MANIFEST) +
-        " 0:" + TEST_MANIFEST.length.to_s + ":invalid_manifest_text.txt\n"
-      end
-    end
-  end
-
   def exit code
     raise "Exit code #{code}" if code == 200
   end
 end
 
+module SalvageCollection
+  def self.salvage_collection_arv_put(temp_file)
+    file_contents = file = File.new(temp_file.path, "r").gets
+
+    # simulate arv-put error when it is 'user_agreement'
+    if file_contents.include? 'GNU_General_Public_License'
+      return ''
+    else
+      ". " +
+      Digest::MD5.hexdigest(TEST_MANIFEST) +
+      " 0:" + TEST_MANIFEST.length.to_s + ":invalid_manifest_text.txt\n"
+    end
+  end
+end
+
 class SalvageCollectionTest < ActiveSupport::TestCase
   include SalvageCollection
 
@@ -92,7 +92,7 @@ class SalvageCollectionTest < ActiveSupport::TestCase
     assert_equal true, exited
   end
 
-  test "salvage collection with during arv-put" do
+  test "salvage collection with error during arv-put" do
     # try to salvage collection while mimicking error during arv-put
     status = SalvageCollection.salvage_collection collections('user_agreement').uuid
     assert_equal false, status

commit 65f76d01b775c944d2ef6c1673633adb6229d9d8
Merge: 21f6342 45fcd8a
Author: radhika <radhika at curoverse.com>
Date:   Tue Aug 18 00:06:49 2015 -0400

    Merge branch 'master' into 6859-fix-invalid-manifests


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list