[ARVADOS] updated: 26196fc6633eb89ed3da425a73b601c5d1e376f2

git at public.curoverse.com git at public.curoverse.com
Tue Dec 9 16:44:39 EST 2014


Summary of changes:
 apps/workbench/test/integration/collection_upload_test.rb |  7 +++++--
 apps/workbench/test/test_helper.rb                        | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

  discards  643c4518354566aa78e8fa468eecbe79151934e2 (commit)
       via  26196fc6633eb89ed3da425a73b601c5d1e376f2 (commit)
       via  00b0287c6ed1bdadd9e31bc2e2b5c0607be19114 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (643c4518354566aa78e8fa468eecbe79151934e2)
            \
             N -- N -- N (26196fc6633eb89ed3da425a73b601c5d1e376f2)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 26196fc6633eb89ed3da425a73b601c5d1e376f2
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Dec 9 16:44:50 2014 -0500

    3781: Add singletest function.

diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index e8f787b..65eed78 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -289,6 +289,20 @@ class RequestDuck
   end
 end
 
+# Example:
+#
+# apps/workbench$ RAILS_ENV=test bundle exec irb -Ilib:test
+# > load 'test/test_helper.rb'
+# > singletest 'integration/collection_upload_test.rb', 'Upload two empty files'
+#
+def singletest test_class_file, test_name
+  load File.join('test', test_class_file)
+  Minitest.run ['-v', '-n', "test_#{test_name.gsub ' ', '_'}"]
+  Object.send(:remove_const,
+              test_class_file.gsub(/.*\/|\.rb$/, '').camelize.to_sym)
+  ::Minitest::Runnable.runnables.reject! { true }
+end
+
 if ENV["RAILS_ENV"].eql? 'test'
   ApiServerForTests.new.run
   ApiServerForTests.new.run ["--websockets"]

commit 00b0287c6ed1bdadd9e31bc2e2b5c0607be19114
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Dec 9 16:44:00 2014 -0500

    3781: Add test cases: empty files, renaming, and error reporting.

diff --git a/apps/workbench/app/assets/javascripts/upload_to_collection.js b/apps/workbench/app/assets/javascripts/upload_to_collection.js
index acdcb24..d4333fa 100644
--- a/apps/workbench/app/assets/javascripts/upload_to_collection.js
+++ b/apps/workbench/app/assets/javascripts/upload_to_collection.js
@@ -394,6 +394,7 @@ function UploadToCollection($scope, $filter, $q, $timeout,
                 return;
             }
 
+            that.state = 'Failed';
             that.stateReason = (
                 (reason.textStatus || 'Error') +
                     (reason.xhr && reason.xhr.options
@@ -465,11 +466,11 @@ function UploadToCollection($scope, $filter, $q, $timeout,
                     }
                 }).
                 then(_deferredAppend.resolve,
-                     _deferredAppend.reject).
+                     _deferredAppend.reject);
+            return _deferredAppend.promise().
                 always(function() {
                     _deferredAppend = null;
                 });
-            return _deferredAppend.promise();
         }
     }
 }
diff --git a/apps/workbench/app/views/collections/_show_upload.html.erb b/apps/workbench/app/views/collections/_show_upload.html.erb
index e42c0e0..40bef52 100644
--- a/apps/workbench/app/views/collections/_show_upload.html.erb
+++ b/apps/workbench/app/views/collections/_show_upload.html.erb
@@ -6,7 +6,7 @@
     <div class="panel-body">
       <div class="row">
         <div class="col-sm-4">
-          <input type="file" multiple ng-model="incoming" onchange="angular.element(this).scope().addFilesToQueue(this.files); $(this).val('');">
+          <input type="file" multiple id="file_selector" ng-model="incoming" onchange="angular.element(this).scope().addFilesToQueue(this.files); $(this).val('');">
           <div class="btn-group btn-group-sm" role="group" style="margin-top: 1.5em">
             <button type="button" class="btn btn-default" ng-click="stop()" ng-disabled="uploader.state !== 'Running'"><i class="fa fa-fw fa-pause"></i> Pause</button>
             <button type="button" class="btn btn-primary" ng-click="go()" ng-disabled="uploader.state === 'Running' || countInStates(['Paused', 'Queued']) === 0"><i class="fa fa-fw fa-play"></i> Start</button>
diff --git a/apps/workbench/test/integration/collection_upload_test.rb b/apps/workbench/test/integration/collection_upload_test.rb
new file mode 100644
index 0000000..1a3449f
--- /dev/null
+++ b/apps/workbench/test/integration/collection_upload_test.rb
@@ -0,0 +1,98 @@
+require 'integration_helper'
+
+class CollectionUploadTest < ActionDispatch::IntegrationTest
+  setup do
+    Headless.new.start
+  end
+
+  setup do
+    testfiles.each do |filename, content|
+      open(testfile_path(filename), 'w') do |io|
+        io.write content
+      end
+    end
+  end
+
+  teardown do
+    testfiles.each do |filename, _|
+      File.unlink(testfile_path filename)
+    end
+  end
+
+  test "Create new collection using upload button" do
+    Capybara.current_driver = :poltergeist
+    visit page_with_token 'active', aproject_path
+    find('.btn', text: 'Add data').click
+    click_link 'Upload files from my computer'
+    # Should be looking at a new empty collection.
+    assert_text 'New collection'
+    assert_text 'd41d8cd98f00b204e9800998ecf8427e+0'
+    # The "Upload" tab should be active and loaded.
+    assert_selector 'div#Upload.active div.panel'
+  end
+
+  test "No Upload tab on non-writable collection" do
+    Capybara.current_driver = :poltergeist
+    visit(page_with_token 'active',
+          '/collections/'+api_fixture('collections')['user_agreement']['uuid'])
+    assert_no_selector '.nav-tabs Upload'
+  end
+
+  test "Upload two empty files with the same name" do
+    Capybara.current_driver = :selenium
+    visit page_with_token 'active', sandbox_path
+    find('.nav-tabs a', text: 'Upload').click
+    attach_file 'file_selector', testfile_path('empty.txt')
+    assert_selector 'div', text: 'empty.txt'
+    attach_file 'file_selector', testfile_path('empty.txt')
+    assert_selector 'div.row div span[title]', text: 'empty.txt', count: 2
+    click_button 'Start'
+    assert_text :visible, 'Done!'
+    visit sandbox_path+'.json'
+    assert_match /_text":"\. d41d8\S+ 0:0:empty.txt\\n\. d41d8\S+ 0:0:empty\\\\040\(1\).txt\\n"/, body
+  end
+
+  test "Upload non-empty files, report errors" do
+    Capybara.current_driver = :selenium
+    visit page_with_token 'active', sandbox_path
+    find('.nav-tabs a', text: 'Upload').click
+    attach_file 'file_selector', testfile_path('a')
+    attach_file 'file_selector', testfile_path('foo.txt')
+    assert_selector 'button:not([disabled])', text: 'Start'
+    click_button 'Start'
+    if "test environment does not have a keepproxy yet, see #4534"
+      assert_text :visible, 'error'
+    else
+      assert_text :visible, 'Done!'
+      visit sandbox_path+'.json'
+      assert_match /_text":"\. 0cc1\S+ 0:1:a\\n\. acbd\S+ 0:3:foo.txt\\n"/, body
+    end
+  end
+
+  protected
+
+  def aproject_path
+    '/projects/' + api_fixture('groups')['aproject']['uuid']
+  end
+
+  def sandbox_uuid
+    api_fixture('collections')['upload_sandbox']['uuid']
+  end
+
+  def sandbox_path
+    '/collections/' + sandbox_uuid
+  end
+
+  def testfiles
+    {
+      'empty.txt' => '',
+      'a' => 'a',
+      'foo.txt' => 'foo'
+    }
+  end
+
+  def testfile_path filename
+    # Must be an absolute path. https://github.com/jnicklas/capybara/issues/621
+    File.join Dir.getwd, 'tmp', filename
+  end
+end
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index bbd362d..f28606a 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -355,6 +355,17 @@ collection_to_search_for_in_aproject:
   manifest_text: ". juku76584cc2f85cedef654fjyhtgimh+3 0:3:foo\n"
   name: "zzzzz-4zz18-abcd6fx123409f7 used to search with any"
 
+upload_sandbox:
+  uuid: zzzzz-4zz18-js48y3ykkfdfjd3
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-12-09 15:03:16
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  modified_at: 2014-12-09 15:03:16
+  portable_data_hash: d41d8cd98f00b204e9800998ecf8427e+0
+  updated_at: 2014-12-09 15:03:16
+  manifest_text: ''
+  name: upload sandbox
+
 # Test Helper trims the rest of the file
 
 # Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list