Commit 409a8a00 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'sy-fix-memoization-leaks' into 'master'

Clear host memoization for metric embeds feature test

See merge request gitlab-org/gitlab!25073
parents 6e99b19e f4406d8f
......@@ -7,6 +7,7 @@ module Gitlab
class Url
class << self
include Gitlab::Utils::StrongMemoize
# Matches urls for a metrics dashboard. This could be
# either the /metrics endpoint or the /metrics_dashboard
# endpoint.
......
......@@ -93,10 +93,20 @@ describe 'Metrics rendering', :js, :use_clean_rails_memory_store_caching, :sidek
# Ensure we identify urls with the appropriate host.
# Configure host to include port in app:
Gitlab.config.gitlab[:url] = root_url.chomp('/')
clear_host_from_memoized_variables
end
def restore_host
default_url_options[:host] = @original_default_host
Gitlab.config.gitlab[:url] = @original_gitlab_url
clear_host_from_memoized_variables
end
def clear_host_from_memoized_variables
[:metrics_regex, :grafana_regex].each do |method_name|
Gitlab::Metrics::Dashboard::Url.clear_memoization(method_name)
end
end
end
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Gitlab::Metrics::Dashboard::Url do
describe '#regex' do
describe '#metrics_regex' do
let(:url) do
Gitlab::Routing.url_helpers.metrics_namespace_project_environment_url(
'foo',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment