From 0143d26db80dabb66825246cd15b0bd06a12eec8 Mon Sep 17 00:00:00 2001 From: Tim Pierce Date: Mon, 16 Jun 2014 13:19:32 -0400 Subject: [PATCH] 2934: document stderr messages for commit tests Some unit tests for the Commit models issue alarming but expected git error messages on stderr. Added comments documenting these in commits_controller_test.rb. Refs #2934. --- .../arvados/v1/commits_controller_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/api/test/functional/arvados/v1/commits_controller_test.rb b/services/api/test/functional/arvados/v1/commits_controller_test.rb index dcc6a638f6..788cd83c79 100644 --- a/services/api/test/functional/arvados/v1/commits_controller_test.rb +++ b/services/api/test/functional/arvados/v1/commits_controller_test.rb @@ -1,6 +1,14 @@ require 'test_helper' load 'test/functional/arvados/v1/git_setup.rb' +# NOTE: calling Commit.find_commit_range(user, nil, nil, 'rev') will produce +# an error message "fatal: bad object 'rev'" on stderr if 'rev' does not exist +# in a given repository. Many of these tests report such errors; their presence +# does not represent a fatal condition. +# +# TODO(twp): consider better error handling of these messages, or +# decide to abandon it. + class Arvados::V1::CommitsControllerTest < ActionController::TestCase fixtures :repositories, :users @@ -15,6 +23,7 @@ class Arvados::V1::CommitsControllerTest < ActionController::TestCase assert_equal ['31ce37fe365b3dc204300a3e4c396ad333ed0556'], a #test "test_branch1" do + # complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57" a = Commit.find_commit_range(users(:active), nil, nil, 'master', nil) assert_equal ['f35f99b7d32bac257f5989df02b9f12ee1a9b0d6', '077ba2ad3ea24a929091a9e6ce545c93199b8e57'], a @@ -33,10 +42,13 @@ class Arvados::V1::CommitsControllerTest < ActionController::TestCase assert_equal nil, a #test "test_multi_revision" do + # complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57" a = Commit.find_commit_range(users(:active), nil, '31ce37fe365b3dc204300a3e4c396ad333ed0556', '077ba2ad3ea24a929091a9e6ce545c93199b8e57', nil) assert_equal ['077ba2ad3ea24a929091a9e6ce545c93199b8e57', '4fe459abe02d9b365932b8f5dc419439ab4e2577', '31ce37fe365b3dc204300a3e4c396ad333ed0556'], a #test "test_tag" do + # complains "fatal: ambiguous argument 'tag1': unknown revision or path + # not in the working tree." a = Commit.find_commit_range(users(:active), nil, 'tag1', 'master', nil) assert_equal ['077ba2ad3ea24a929091a9e6ce545c93199b8e57', '4fe459abe02d9b365932b8f5dc419439ab4e2577'], a @@ -45,6 +57,7 @@ class Arvados::V1::CommitsControllerTest < ActionController::TestCase assert_equal ['077ba2ad3ea24a929091a9e6ce545c93199b8e57', '31ce37fe365b3dc204300a3e4c396ad333ed0556'], a #test "test_multi_revision_tagged_exclude" do + # complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57" a = Commit.find_commit_range(users(:active), nil, '31ce37fe365b3dc204300a3e4c396ad333ed0556', '077ba2ad3ea24a929091a9e6ce545c93199b8e57', ['tag1']) assert_equal ['077ba2ad3ea24a929091a9e6ce545c93199b8e57', '31ce37fe365b3dc204300a3e4c396ad333ed0556'], a @@ -70,11 +83,13 @@ class Arvados::V1::CommitsControllerTest < ActionController::TestCase assert_equal nil, a # invalid input to 'excludes' + # complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57" a = Commit.find_commit_range(users(:active), nil, "31ce37fe365b3dc204300a3e4c396ad333ed0556", "077ba2ad3ea24a929091a9e6ce545c93199b8e57", ["4fe459abe02d9b365932b8f5dc419439ab4e2577 ; touch #{touchdir}/uh_oh"]) assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable" assert_equal nil, a # invalid input to 'excludes' + # complains "fatal: bad object 077ba2ad3ea24a929091a9e6ce545c93199b8e57" a = Commit.find_commit_range(users(:active), nil, "31ce37fe365b3dc204300a3e4c396ad333ed0556", "077ba2ad3ea24a929091a9e6ce545c93199b8e57", ["$(uname>#{touchdir}/uh_oh)"]) assert !File.exists?("#{touchdir}/uh_oh"), "#{touchdir}/uh_oh should not exist, 'excludes' parameter of find_commit_range is exploitable" assert_equal nil, a -- 2.30.2