[ARVADOS] updated: 5517f022cdb6233551c9281422c033d18293ec03

git at public.curoverse.com git at public.curoverse.com
Tue Feb 17 01:34:51 EST 2015


Summary of changes:
 sdk/python/tests/test_api.py                       | 28 ++++++++++++++--
 services/api/config/initializers/time_format.rb    |  2 +-
 .../api/test/functional/arvados/v1/filters_test.rb | 38 ++++++++++++++++++++++
 3 files changed, 65 insertions(+), 3 deletions(-)

       via  5517f022cdb6233551c9281422c033d18293ec03 (commit)
       via  6ee389b798bd7898e16b8ab8bf9394bf97c40f46 (commit)
       via  4f8b2d755cb8249cd9118b7d3213a0021b83b0cb (commit)
      from  5f2d5f96abb8941bed95bd9f47f79f6f1c3ba38d (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 5517f022cdb6233551c9281422c033d18293ec03
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 17 01:35:41 2015 -0500

    4759: Add functional tests for timestamp precision.

diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 604f421..2349993 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -54,4 +54,42 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
     assert_response 422
     assert_match /not supported/, json_response['errors'].join(' ')
   end
+
+  test 'api responses provide timestamps with nanoseconds' do
+    @controller = Arvados::V1::CollectionsController.new
+    authorize_with :active
+    get :index
+    assert_response :success
+    assert_not_empty json_response['items']
+    json_response['items'].each do |item|
+      %w(created_at modified_at).each do |attr|
+        # Pass fixtures with null timestamps.
+        next if item[attr].nil?
+        assert_match /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d.\d{9}Z$/, item[attr]
+      end
+    end
+  end
+
+  %w(< > <= >= =).each do |operator|
+    test "timestamp #{operator} filters work with nanosecond precision" do
+      expect_match = !!operator.index('=')
+      mine = act_as_user users(:active) do
+        Collection.create!(manifest_text: '')
+      end
+      timestamp = mine.modified_at.strftime('%Y-%m-%dT%H:%M:%S.%NZ')
+      @controller = Arvados::V1::CollectionsController.new
+      authorize_with :active
+      get :index, {
+        filters: [['modified_at', operator, timestamp],
+                  ['uuid', '=', mine.uuid]],
+      }
+      assert_response :success
+      uuids = json_response['items'].map { |item| item['uuid'] }
+      if expect_match
+        assert_includes uuids, mine.uuid
+      else
+        assert_not_includes uuids, mine.uuid
+      end
+    end
+  end
 end

commit 6ee389b798bd7898e16b8ab8bf9394bf97c40f46
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Feb 16 22:36:03 2015 -0500

    4759: Add test for inequality filters.

diff --git a/sdk/python/tests/test_api.py b/sdk/python/tests/test_api.py
index 576e47a..5cf2d2b 100644
--- a/sdk/python/tests/test_api.py
+++ b/sdk/python/tests/test_api.py
@@ -59,11 +59,35 @@ class ArvadosApiClientTest(unittest.TestCase):
                    for index in [0, 1]]
         self.assertIsNot(*clients)
 
-    def test_basic_list(self):
-        answer = self.api.humans().list(
+    def test_empty_list(self):
+        answer = arvados.api('v1').humans().list(
             filters=[['uuid', 'is', None]]).execute()
         self.assertEqual(answer['items_available'], len(answer['items']))
 
+    def test_nonempty_list(self):
+        answer = arvados.api('v1').collections().list().execute()
+        self.assertNotEqual(0, answer['items_available'])
+        self.assertNotEqual(0, len(answer['items']))
+
+    def test_timestamp_inequality_filter(self):
+        api = arvados.api('v1')
+        new_item = api.specimens().create(body={}).execute()
+        for operator, should_include in [
+                ['<', False], ['>', False],
+                ['<=', True], ['>=', True], ['=', True]]:
+            response = api.specimens().list(filters=[
+                ['created_at', operator, new_item['created_at']],
+                # Also filter by uuid to ensure (if it matches) it's on page 0
+                ['uuid', '=', new_item['uuid']]]).execute()
+            uuids = [item['uuid'] for item in response['items']]
+            did_include = new_item['uuid'] in uuids
+            self.assertEqual(
+                did_include, should_include,
+                "'%s %s' filter should%s have matched '%s'" % (
+                    operator, new_item['created_at'],
+                    ('' if should_include else ' not'),
+                    new_item['created_at']))
+
     def test_exceptions_include_errors(self):
         with self.assertRaises(apiclient_errors.HttpError) as err_ctx:
             self.api.humans().get(uuid='xyz-xyz-abcdef').execute()

commit 4f8b2d755cb8249cd9118b7d3213a0021b83b0cb
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Feb 16 22:35:20 2015 -0500

    4759: Ignore args to as_json.

diff --git a/services/api/config/initializers/time_format.rb b/services/api/config/initializers/time_format.rb
index ca67b19..d476781 100644
--- a/services/api/config/initializers/time_format.rb
+++ b/services/api/config/initializers/time_format.rb
@@ -1,5 +1,5 @@
 class ActiveSupport::TimeWithZone
-  def as_json
+  def as_json *args
     strftime "%Y-%m-%dT%H:%M:%S.%NZ"
   end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list