debian-mirror-gitlab/spec/features/projects/environments_pod_logs_spec.rb

69 lines
2.3 KiB
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Environment > Pod Logs', :js, :kubeclient do
2020-04-22 19:07:51 +05:30
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
2020-07-28 23:09:34 +05:30
cluster = create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project])
2020-04-22 19:07:51 +05:30
create(:deployment, :success, environment: environment)
stub_kubeclient_pods(environment.deployment_namespace)
stub_kubeclient_logs(pod_name, environment.deployment_namespace, container: 'container-0')
2021-03-08 18:12:59 +05:30
stub_kubeclient_deployments(environment.deployment_namespace)
stub_kubeclient_ingresses(environment.deployment_namespace)
2020-07-28 23:09:34 +05:30
stub_kubeclient_nodes_and_nodes_metrics(cluster.platform.api_url)
2020-04-22 19:07:51 +05:30
2022-04-04 11:22:00 +05:30
sign_in(project.first_owner)
2020-04-22 19:07:51 +05:30
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-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)
2021-09-04 01:27:46 +05:30
expect(dropdown_items.size).to eq(2)
2020-04-22 19:07:51 +05:30
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
2021-10-27 15:23:28 +05:30
page.within('.qa-pods-dropdown') do # rubocop:disable QA/SelectorUsage
2020-04-22 19:07:51 +05:30
find(".dropdown-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("kube-pod | Log 1")
expect(page).to have_content("kube-pod | Log 2")
expect(page).to have_content("kube-pod | Log 3")
end
end
end