[ARVADOS] updated: b6f73f7acffa9b2f37c78826ff6cee89987a7edc

git at public.curoverse.com git at public.curoverse.com
Mon Jan 5 10:20:03 EST 2015


Summary of changes:
 .../api/db/migrate/20141208174553_descriptions_are_strings.rb |  4 +++-
 services/api/test/unit/arvados_model_test.rb                  | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

       via  b6f73f7acffa9b2f37c78826ff6cee89987a7edc (commit)
       via  9468edd5242e5372ce2ed36f2a7448b63a5b45b1 (commit)
       via  9df51438367e129d0d306801eb20215cc2a0fafc (commit)
      from  49030c3161523bc427e0aaa9d3edb517fc4c296c (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 b6f73f7acffa9b2f37c78826ff6cee89987a7edc
Merge: 9468edd 49030c3
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 5 10:05:57 2015 -0500

    4523: Merge branch '4523-search-index' of git.curoverse.com:arvados into 4523-search-index
    
    Conflicts:
    	services/api/test/unit/arvados_model_test.rb

diff --cc services/api/test/unit/arvados_model_test.rb
index 4d8e003,63b4773..a8175d3
--- a/services/api/test/unit/arvados_model_test.rb
+++ b/services/api/test/unit/arvados_model_test.rb
@@@ -87,54 -87,26 +87,37 @@@ class ArvadosModelTest < ActiveSupport:
      end
    end
  
 +  test "store long string" do
 +    set_user_from_auth :active
 +    longstring = "a"
 +    while longstring.length < 2**28
 +      longstring = longstring + longstring
 +    end
 +    g = Group.create! name: 'Has a long description', description: longstring
 +    g = Group.find_by_uuid g.uuid
 +    assert_equal g.description, longstring
 +  end
 +
-   test "unique uuid index exists on all models with the column uuid" do
-     tables = ActiveRecord::Base.connection.tables
-     tables.each do |table|
-       columns = ActiveRecord::Base.connection.columns(table)
- 
-       uuid_column = columns.select do |column|
-         column.name == 'uuid'
-       end
- 
-       if !uuid_column.empty?
-         indexes = ActiveRecord::Base.connection.indexes(table)
-         uuid_index = indexes.select do |index|
-           index.columns == ['uuid'] and index.unique == true
-         end
- 
-         assert !uuid_index.empty?, "#{table} does not have unique uuid index"
-       end
-     end
-   end
- 
-   test "owner uuid index exists on all models with the owner_uuid column" do
-     all_tables = ActiveRecord::Base.connection.tables
- 
-     all_tables.each do |table|
-       columns = ActiveRecord::Base.connection.columns(table)
- 
-       uuid_column = columns.select do |column|
-         column.name == 'owner_uuid'
-       end
- 
-       if !uuid_column.empty?
-         indexes = ActiveRecord::Base.connection.indexes(table)
-         owner_uuid_index = indexes.select do |index|
-           index.columns == ['owner_uuid']
+   [['uuid', {unique: true}],
+    ['owner_uuid', {}]].each do |the_column, requires|
+     test "unique index on all models with #{the_column}" do
+       checked = 0
+       ActiveRecord::Base.connection.tables.each do |table|
+         columns = ActiveRecord::Base.connection.columns(table)
+ 
+         next unless columns.collect(&:name).include? the_column
+ 
+         indexes = ActiveRecord::Base.connection.indexes(table).reject do |index|
+           requires.map do |key, val|
+             index.send(key) == val
+           end.include? false
          end
-         assert !owner_uuid_index.empty?, "#{table} does not have owner_uuid index"
+         assert_includes indexes.collect(&:columns), [the_column], 'no index'
+         checked += 1
        end
+       # Sanity check: make sure we didn't just systematically miss everything.
+       assert_operator(10, :<, checked,
+                       "Only #{checked} tables have a #{the_column}?!")
      end
    end
  

commit 9468edd5242e5372ce2ed36f2a7448b63a5b45b1
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Dec 29 12:35:29 2014 -0500

    4523: Fix down-migration.

diff --git a/services/api/db/migrate/20141208174553_descriptions_are_strings.rb b/services/api/db/migrate/20141208174553_descriptions_are_strings.rb
index b33a49a..9c7633f 100644
--- a/services/api/db/migrate/20141208174553_descriptions_are_strings.rb
+++ b/services/api/db/migrate/20141208174553_descriptions_are_strings.rb
@@ -11,7 +11,9 @@ class DescriptionsAreStrings < ActiveRecord::Migration
 
   def down
     tables_with_description_column.each do |table|
-      if table != 'collections'
+      if table == 'collections'
+        change_column table.to_sym, :description, :string # implicit limit 255
+      else
         change_column table.to_sym, :description, :text
       end
     end

commit 9df51438367e129d0d306801eb20215cc2a0fafc
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Dec 29 12:27:26 2014 -0500

    4523: Add "store long string" test.

diff --git a/services/api/test/unit/arvados_model_test.rb b/services/api/test/unit/arvados_model_test.rb
index b353793..4d8e003 100644
--- a/services/api/test/unit/arvados_model_test.rb
+++ b/services/api/test/unit/arvados_model_test.rb
@@ -87,6 +87,17 @@ class ArvadosModelTest < ActiveSupport::TestCase
     end
   end
 
+  test "store long string" do
+    set_user_from_auth :active
+    longstring = "a"
+    while longstring.length < 2**28
+      longstring = longstring + longstring
+    end
+    g = Group.create! name: 'Has a long description', description: longstring
+    g = Group.find_by_uuid g.uuid
+    assert_equal g.description, longstring
+  end
+
   test "unique uuid index exists on all models with the column uuid" do
     tables = ActiveRecord::Base.connection.tables
     tables.each do |table|

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list