2017-03-07 11:57:42 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Environment > Metrics' do
|
2017-03-07 11:57:42 -05:00
|
|
|
include PrometheusHelpers
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:prometheus_project) }
|
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
|
|
|
let(:environment) { create(:environment, project: project) }
|
|
|
|
let(:current_time) { Time.now.utc }
|
2017-03-07 11:57:42 -05:00
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
before do
|
2017-03-07 11:57:42 -05:00
|
|
|
project.add_developer(user)
|
|
|
|
create(:deployment, environment: environment, deployable: build)
|
|
|
|
stub_all_prometheus_requests(environment.slug)
|
|
|
|
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-03-07 11:57:42 -05:00
|
|
|
visit_environment(environment)
|
|
|
|
end
|
|
|
|
|
|
|
|
around do |example|
|
|
|
|
Timecop.freeze(current_time) { example.run }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with deployments and related deployable present' do
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'shows metrics' do
|
2017-03-07 11:57:42 -05:00
|
|
|
click_link('See metrics')
|
|
|
|
|
2017-06-26 11:40:20 -04:00
|
|
|
expect(page).to have_css('div#prometheus-graphs')
|
2017-03-07 11:57:42 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visit_environment(environment)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_environment_path(environment.project, environment)
|
2017-03-07 11:57:42 -05:00
|
|
|
end
|
|
|
|
end
|