5011: 3410: Export client-specified redundancy as replication_desired.
authorTom Clegg <tom@curoverse.com>
Sat, 31 Jan 2015 08:52:51 +0000 (03:52 -0500)
committerTom Clegg <tom@curoverse.com>
Sun, 1 Feb 2015 01:35:10 +0000 (20:35 -0500)
sdk/python/tests/test_arv_put.py
services/api/app/models/collection.rb

index 9d19e8d79a52471a21a6084cff11f44de27dcb86..196264f766ae402cc64edba259c6bbfb2c1f23db 100644 (file)
@@ -535,11 +535,11 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
         # making sure collections.create tells the API server what our
         # desired replication level is.
         collection = self.run_and_find_collection("", ['--replication', '4'])
-        self.assertEqual(4, collection['redundancy'])
+        self.assertEqual(4, collection['replication_desired'])
 
     def test_put_collection_with_default_redundancy(self):
         collection = self.run_and_find_collection("")
-        self.assertEqual(2, collection['redundancy'])
+        self.assertEqual(2, collection['replication_desired'])
 
     def test_put_collection_with_unnamed_project_link(self):
         link = self.run_and_find_collection(
index 457fb5f778cb3429d0d19f3104b6142a2a171dfe..cd334d5dae83e4ba716c8d665e9a69e04b113a26 100644 (file)
@@ -21,6 +21,7 @@ class Collection < ArvadosModel
     t.add :properties
     t.add :portable_data_hash
     t.add :signed_manifest_text, as: :manifest_text
+    t.add :replication_desired
   end
 
   def self.attributes_required_columns
@@ -28,7 +29,8 @@ class Collection < ArvadosModel
     # confused by the way we expose signed_manifest_text as
     # manifest_text in the API response, and never let clients select
     # the manifest_text column.
-    super.merge('manifest_text' => ['manifest_text'])
+    super.merge('manifest_text' => ['manifest_text'],
+                'replication_desired' => ['redundancy'])
   end
 
   def check_signatures
@@ -175,6 +177,11 @@ class Collection < ArvadosModel
     end
   end
 
+  def replication_desired
+    # Shim until database columns get fixed up in #3410.
+    redundancy or 2
+  end
+
   def redundancy_status
     if redundancy_confirmed_as.nil?
       'unconfirmed'