diff options
Diffstat (limited to 'spec/serializers/environment_entity_spec.rb')
-rw-r--r-- | spec/serializers/environment_entity_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/serializers/environment_entity_spec.rb b/spec/serializers/environment_entity_spec.rb index f392ecea959..b4ea90d2141 100644 --- a/spec/serializers/environment_entity_spec.rb +++ b/spec/serializers/environment_entity_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe EnvironmentEntity do + include Gitlab::Routing.url_helpers + let(:request) { double('request') } let(:entity) do described_class.new(environment, request: spy('request')) @@ -71,4 +73,22 @@ describe EnvironmentEntity do expect(subject).to include(:cancel_auto_stop_path, :auto_stop_at) end end + + context 'pod_logs' do + it 'exposes logs keys' do + expect(subject).to include(:logs_path) + expect(subject).to include(:logs_api_path) + expect(subject).to include(:enable_advanced_logs_querying) + end + + it 'uses k8s api when ES is not available' do + expect(subject[:logs_api_path]).to eq(k8s_project_logs_path(environment.project, environment_name: environment.name, format: :json)) + end + + it 'uses ES api when ES is available' do + allow(environment).to receive(:elastic_stack_available?).and_return(true) + + expect(subject[:logs_api_path]).to eq(elasticsearch_project_logs_path(environment.project, environment_name: environment.name, format: :json)) + end + end end |