Skip to content

Commit

Permalink
Merge pull request #2829 from newrelic/Mi_Amor,_Mi_Vampira
Browse files Browse the repository at this point in the history
CI: Healthy URL checker tweaks
  • Loading branch information
fallwith authored Aug 26, 2024
2 parents 5beb294 + 92030d3 commit 992426d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion test/helpers/misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,11 @@ def skip_unless_ci_cron
skip 'This test only runs as part of the CI cron workflow'
end

# If in a CI (non local dev) context, skip unless operating within the
# special CI context. When in a local dev context or in a special CI context,
# permit the test(s) to run.
def skip_unless_special_ci
return if ENV['SPECIAL_CI']
return if ENV.fetch('CI', nil).nil? || ENV.fetch('SPECIAL_CI', nil)

skip 'This test only runs as part of the special CI workflow'
end
Expand Down
4 changes: 2 additions & 2 deletions test/new_relic/healthy_urls_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class HealthyUrlsTest < Minitest::Test
FILE_PATTERN = /(?:^(?:#{FILENAMES.join('|')})$)|\.(?:#{EXTENSIONS.join('|')})$/.freeze
IGNORED_FILE_PATTERN = %r{/(?:coverage|test)/}.freeze
URL_PATTERN = %r{(https?://.*?)[^a-zA-Z0-9/\.\-_#]}.freeze
IGNORED_URL_PATTERN = %r{(?:\{|\(|\$|169\.254|\.\.\.|learn\.|metadata\.google|honeyryderchuck\.gitlab\.io/httpx|http://#)}
IGNORED_URL_PATTERN = %r{(?:\{|\(|\$|169\.254|\.\.\.|learn\.|metadata\.google|honeyryderchuck\.gitlab\.io/httpx|https?://#)}
TIMEOUT = 5
DEBUG = false

Expand Down Expand Up @@ -103,7 +103,7 @@ def gather_urls
next unless line =~ URL_PATTERN

url = Regexp.last_match(1).sub(%r{(?:/|\.)$}, '')
urls[url] << file if real_url?(url)
urls[url] << file if urls.key?(url) || real_url?(url)
end
end
end
Expand Down

0 comments on commit 992426d

Please sign in to comment.