From e0e85a31394bb8f1aa823a44a9441128d1710f5e Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Tue, 11 Sep 2018 13:43:11 -0700 Subject: [PATCH] skip additional tests failures that are caused by networking issues --- test/functional/sources_controller_test.rb | 8 ++------ test/models/upload_service_test.rb | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/test/functional/sources_controller_test.rb b/test/functional/sources_controller_test.rb index 33be98670..f58b87de4 100644 --- a/test/functional/sources_controller_test.rb +++ b/test/functional/sources_controller_test.rb @@ -4,12 +4,8 @@ class SourcesControllerTest < ActionDispatch::IntegrationTest context "The sources controller" do context "show action" do should "work for a pixiv URL" do - begin - get source_path, params: { url: "http://www.pixiv.net/member_illust.php?mode=medium&illust_id=14901720", format: "json" } - assert_response :success - rescue Net::OpenTimeout - skip "Remote connection failed to Pixiv failed" - end + get source_path, params: { url: "http://www.pixiv.net/member_illust.php?mode=medium&illust_id=14901720", format: "json" } + assert_response :success end should "work for a direct twitter URL with referer" do diff --git a/test/models/upload_service_test.rb b/test/models/upload_service_test.rb index 07ecc270f..df90c10e9 100644 --- a/test/models/upload_service_test.rb +++ b/test/models/upload_service_test.rb @@ -42,11 +42,15 @@ class UploadServiceTest < ActiveSupport::TestCase end should "work on an ugoira url" do - file = subject.download_for_upload(@upload) + begin + file = subject.download_for_upload(@upload) - assert_operator(File.size(file.path), :>, 0) + assert_operator(File.size(file.path), :>, 0) - file.close + file.close + rescue Net::OpenTimeout + skip "network problems" + end end end @@ -418,7 +422,11 @@ class UploadServiceTest < ActiveSupport::TestCase should "download the file" do @service = subject.new(source: @source) - @upload = @service.start! + begin + @upload = @service.start! + rescue Net::OpenTimeout + skip "network problems" + end assert_equal("preprocessed", @upload.status) assert_equal(2804, @upload.file_size) assert_equal("zip", @upload.file_ext) @@ -435,7 +443,11 @@ class UploadServiceTest < ActiveSupport::TestCase should "download the file" do @service = subject.new(source: @source) - @upload = @service.start! + begin + @upload = @service.start! + rescue Net::OpenTimeout + skip "network problems" + end assert_equal("preprocessed", @upload.status) assert_equal(181309, @upload.file_size) assert_equal("jpg", @upload.file_ext)