2017-03-07 16:57:42 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'Environment > Metrics', :feature do
|
|
|
|
include PrometheusHelpers
|
|
|
|
|
|
|
|
given(:user) { create(:user) }
|
|
|
|
given(:project) { create(:prometheus_project) }
|
|
|
|
given(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
given(:build) { create(:ci_build, pipeline: pipeline) }
|
|
|
|
given(:environment) { create(:environment, project: project) }
|
|
|
|
given(:current_time) { Time.now.utc }
|
|
|
|
|
|
|
|
background do
|
|
|
|
project.add_developer(user)
|
|
|
|
create(:deployment, environment: environment, deployable: build)
|
|
|
|
stub_all_prometheus_requests(environment.slug)
|
|
|
|
|
2017-06-05 18:44:29 +00:00
|
|
|
gitlab_sign_in(user)
|
2017-03-07 16:57:42 +00:00
|
|
|
visit_environment(environment)
|
|
|
|
end
|
|
|
|
|
|
|
|
around do |example|
|
|
|
|
Timecop.freeze(current_time) { example.run }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with deployments and related deployable present' do
|
|
|
|
scenario 'shows metrics' do
|
|
|
|
click_link('See metrics')
|
|
|
|
|
2017-06-26 15:40:20 +00:00
|
|
|
expect(page).to have_css('div#prometheus-graphs')
|
2017-03-07 16:57:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visit_environment(environment)
|
|
|
|
visit namespace_project_environment_path(environment.project.namespace,
|
|
|
|
environment.project,
|
|
|
|
environment)
|
|
|
|
end
|
|
|
|
end
|