diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 21:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 21:09:17 +0300 |
commit | 0eb4fd2f32e6804bc85868ba167170238e346279 (patch) | |
tree | c020e787ea29c77e1e9f53c21940f88a87a6e905 /spec/features | |
parent | 78d8830cec030ff12afed3c8ae1dddec454d0a24 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/environments_pod_logs_spec.rb | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/features/projects/environments_pod_logs_spec.rb b/spec/features/projects/environments_pod_logs_spec.rb new file mode 100644 index 00000000000..121a8e1705b --- /dev/null +++ b/spec/features/projects/environments_pod_logs_spec.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Environment > Pod Logs', :js do + include KubernetesHelpers + + let(:pod_names) { %w(kube-pod) } + let(:pod_name) { pod_names.first } + let(:project) { create(:project, :repository) } + let(:environment) { create(:environment, project: project) } + let(:service) { create(:cluster_platform_kubernetes, :configured) } + + before do + create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project]) + create(:deployment, :success, environment: environment) + + stub_kubeclient_pods(environment.deployment_namespace) + stub_kubeclient_logs(pod_name, environment.deployment_namespace, container: 'container-0') + + sign_in(project.owner) + end + + it "shows environments in dropdown" do + create(:environment, project: project) + + visit project_logs_path(environment.project, environment_name: environment.name, pod_name: pod_name) + + wait_for_requests + + page.within('.js-environments-dropdown') do + toggle = find(".dropdown-menu-toggle:not([disabled])") + + expect(toggle).to have_content(environment.name) + + toggle.click + + dropdown_items = find(".dropdown-menu").all(".dropdown-item") + expect(dropdown_items.first).to have_content(environment.name) + expect(dropdown_items.size).to eq(2) + end + end + + context 'with logs', :use_clean_rails_memory_store_caching do + it "shows pod logs", :sidekiq_might_not_need_inline do + visit project_logs_path(environment.project, environment_name: environment.name, pod_name: pod_name) + + wait_for_requests + + page.within('.js-pods-dropdown') do + find(".dropdown-menu-toggle:not([disabled])").click + + dropdown_items = find(".dropdown-menu").all(".dropdown-item:not([disabled])") + expect(dropdown_items.size).to eq(1) + + dropdown_items.each_with_index do |item, i| + expect(item.text).to eq(pod_names[i]) + end + end + expect(page).to have_content("Dec 13 14:04:22.123Z | kube-pod | Log 1 Dec 13 14:04:23.123Z | kube-pod | Log 2 Dec 13 14:04:24.123Z | kube-pod | Log 3") + end + end +end |