[ARVADOS] updated: 71143e41dbc8755d5ccb97990525bbb05aad69e9

git at public.curoverse.com git at public.curoverse.com
Wed May 7 11:05:42 EDT 2014


Summary of changes:
 .../functional/arvados/v1/jobs_controller_test.rb  |   50 +++++++++----------
 1 files changed, 24 insertions(+), 26 deletions(-)

       via  71143e41dbc8755d5ccb97990525bbb05aad69e9 (commit)
      from  45938e41f983ce41d8b55c3f980b7f31bc269124 (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 71143e41dbc8755d5ccb97990525bbb05aad69e9
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed May 7 11:05:22 2014 -0400

    Improve tests: multiple values for "not in", check =, != results more carefully.

diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index d671e94..0d1f71f 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -178,39 +178,37 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
   end
 
   test "search jobs by uuid with 'not in' query" do
+    exclude_uuids = [jobs(:running).uuid,
+                     jobs(:running_cancelled).uuid]
     authorize_with :active
     get :index, {
-      filters: [['uuid', 'not in', ['zzzzz-8i9sb-pshmckwoma9plh7']]]
+      filters: [['uuid', 'not in', exclude_uuids]]
     }
     assert_response :success
     found = assigns(:objects).collect(&:uuid)
-    assert_not_equal [], found, "'not in' query returned nothing"
-    assert_not_includes found, 'zzzzz-8i9sb-pshmckwoma9plh7',
-    "'not in' query returned the very thing I did not want"
+    assert_not_empty found, "'not in' query returned nothing"
+    assert_empty(found & exclude_uuids,
+                 "'not in' query returned uuids I asked not to get")
   end
 
-  test "search jobs by uuid with '!=' query" do
-    authorize_with :active
-    get :index, {
-      filters: [['uuid', '!=', 'zzzzz-8i9sb-pshmckwoma9plh7']]
-    }
-    assert_response :success
-    found = assigns(:objects).collect(&:uuid)
-    assert_not_equal [], found, "'!=' query returned nothing"
-    assert_not_includes found, 'zzzzz-8i9sb-pshmckwoma9plh7',
-    "'!=' query returned the very thing I did not want"
-  end
-
-  test "search jobs by output with '!= nil' query" do
-    authorize_with :active
-    get :index, {
-      filters: [['output', '!=', nil]]
-    }
-    assert_response :success
-    found = assigns(:objects).collect(&:output)
-    assert_not_equal [], found, "'!= nil' query returned nothing"
-    assert_not_includes found, nil,
-    "'!= nil' query returned the very thing I did not want"
+  ['=', '!='].each do |operator|
+    [['uuid', 'zzzzz-8i9sb-pshmckwoma9plh7'],
+     ['output', nil]].each do |attr, operand|
+      test "search jobs with #{attr} #{operator} #{operand.inspect} query" do
+        authorize_with :active
+        get :index, {
+          filters: [[attr, operator, operand]]
+        }
+        assert_response :success
+        values = assigns(:objects).collect { |x| x.send(attr) }
+        assert_not_empty values, "query should return non-empty result"
+        if operator == '='
+          assert_empty values - [operand], "query results do not satisfy query"
+        else
+          assert_empty values & [operand], "query results do not satisfy query"
+        end
+      end
+    end
   end
 
   test "search jobs by started_at with < query" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list