diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 15:09:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 15:09:29 +0000 |
commit | 5372e109c0660e4670aa987568a51082beca1b3c (patch) | |
tree | 76f8f1178d5f304f0aea8c0c610729f695c9e18e /spec/models/concerns | |
parent | 403678e00406edc8094f087ec70e00aa29e49bef (diff) | |
download | gitlab-ce-5372e109c0660e4670aa987568a51082beca1b3c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/prometheus_adapter_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/concerns/prometheus_adapter_spec.rb b/spec/models/concerns/prometheus_adapter_spec.rb index bc58df7e7c2..fdc98ba74b8 100644 --- a/spec/models/concerns/prometheus_adapter_spec.rb +++ b/spec/models/concerns/prometheus_adapter_spec.rb @@ -18,6 +18,29 @@ describe PrometheusAdapter, :use_clean_rails_memory_store_caching do let(:environment_query) { Gitlab::Prometheus::Queries::EnvironmentQuery } describe '#query' do + describe 'validate_query' do + let(:environment) { build_stubbed(:environment, slug: 'env-slug') } + let(:validation_query) { Gitlab::Prometheus::Queries::ValidateQuery.name } + let(:query) { 'avg(response)' } + let(:validation_respone) { { data: { valid: true } } } + + around do |example| + Timecop.freeze { example.run } + end + + context 'with valid data' do + subject { service.query(:validate, query) } + + before do + stub_reactive_cache(service, validation_respone, validation_query, query) + end + + it 'returns query data' do + is_expected.to eq(query: { valid: true }) + end + end + end + describe 'environment' do let(:environment) { build_stubbed(:environment, slug: 'env-slug') } |