tests: fix more spurious test failures in CI.

* Skip Nijie tests because they fail a lot due to Nijie rate limiting us.
* Skip ArtStation downloads tests because they sometimes return different file sizes.
* Fix random duplicate favgroup errors because favgroup names weren't random enough.
This commit is contained in:
evazion
2021-10-01 18:02:01 -05:00
parent 5ef231e1dc
commit cdd46b0ac5
4 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :favorite_group do factory :favorite_group do
creator creator
name { FFaker::Lorem.word } name { SecureRandom.uuid }
end end
end end

View File

@@ -157,6 +157,8 @@ class DanbooruHttpTest < ActiveSupport::TestCase
context "unpolish cloudflare feature" do context "unpolish cloudflare feature" do
should "return the original image for polished images" do should "return the original image for polished images" do
skip if ENV["CI"].present?
url = "https://cdnb.artstation.com/p/assets/images/images/025/273/307/4k/atey-ghailan-a-sage-keyart-s-ch-04-outlined-1.jpg?1585246642" url = "https://cdnb.artstation.com/p/assets/images/images/025/273/307/4k/atey-ghailan-a-sage-keyart-s-ch-04-outlined-1.jpg?1585246642"
response = Danbooru::Http.use(:unpolish_cloudflare).get(url) response = Danbooru::Http.use(:unpolish_cloudflare).get(url)

View File

@@ -10,6 +10,8 @@ module Downloads
context "for an image where an original does not exist" do context "for an image where an original does not exist" do
should "not try to download the original" do should "not try to download the original" do
skip if ENV["CI"].present?
assert_downloaded(452_795, "https://cdna.artstation.com/p/assets/images/images/004/730/278/large/mendel-oh-dragonll.jpg") assert_downloaded(452_795, "https://cdna.artstation.com/p/assets/images/images/004/730/278/large/mendel-oh-dragonll.jpg")
end end
end end

View File

@@ -4,8 +4,7 @@ module Sources
class NijieTest < ActiveSupport::TestCase class NijieTest < ActiveSupport::TestCase
setup do setup do
skip "Nijie credentials not configured" unless Sources::Strategies::Nijie.enabled? skip "Nijie credentials not configured" unless Sources::Strategies::Nijie.enabled?
# Add a random delay to work around test failures due to rate limiting by Nijie. skip if ENV["CI"].present?
sleep (3..5).to_a.sample
end end
context "downloading a 'http://nijie.info/view.php?id=:id' url" do context "downloading a 'http://nijie.info/view.php?id=:id' url" do