2017-12-05 07:00:02 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Clusters Applications', :js do
|
2017-12-05 07:00:02 -05:00
|
|
|
include GoogleApi::CloudPlatformHelpers
|
|
|
|
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-12-05 07:00:02 -05:00
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Installing applications' do
|
|
|
|
before do
|
|
|
|
visit project_cluster_path(project, cluster)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when cluster is being created' do
|
2019-03-05 08:33:09 -05:00
|
|
|
let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) }
|
2017-12-05 07:00:02 -05:00
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'user is unable to install applications' do
|
2017-12-05 07:00:02 -05:00
|
|
|
page.within('.js-cluster-application-row-helm') do
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Install')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when cluster is created' do
|
2019-03-05 08:33:09 -05:00
|
|
|
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
|
2017-12-05 07:00:02 -05:00
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'user can install applications' do
|
2019-03-06 07:48:45 -05:00
|
|
|
wait_for_requests
|
|
|
|
|
2017-12-05 07:00:02 -05:00
|
|
|
page.within('.js-cluster-application-row-helm') do
|
|
|
|
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to be_nil
|
2018-02-22 19:46:32 -05:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Install')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user installs Helm' do
|
|
|
|
before do
|
2018-02-22 19:46:32 -05:00
|
|
|
allow(ClusterInstallAppWorker).to receive(:perform_async)
|
2017-12-05 07:00:02 -05:00
|
|
|
|
|
|
|
page.within('.js-cluster-application-row-helm') do
|
|
|
|
page.find(:css, '.js-cluster-application-install-button').click
|
|
|
|
end
|
2019-03-06 07:48:45 -05:00
|
|
|
|
|
|
|
wait_for_requests
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
|
2018-08-07 08:39:38 -04:00
|
|
|
it 'they see status transition' do
|
2017-12-05 07:00:02 -05:00
|
|
|
page.within('.js-cluster-application-row-helm') do
|
2019-02-01 05:44:49 -05:00
|
|
|
# FE sends request and gets the response, then the buttons is "Installing"
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
|
2017-12-05 07:00:02 -05:00
|
|
|
|
|
|
|
Clusters::Cluster.last.application_helm.make_installing!
|
|
|
|
|
|
|
|
# FE starts polling and update the buttons to "Installing"
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
|
2017-12-05 07:00:02 -05:00
|
|
|
|
|
|
|
Clusters::Cluster.last.application_helm.make_installed!
|
|
|
|
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installed')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
|
2018-01-29 14:49:00 -05:00
|
|
|
expect(page).to have_content('Helm Tiller was successfully installed on your Kubernetes cluster')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-13 10:39:44 -05:00
|
|
|
context 'when user installs Knative' do
|
|
|
|
before do
|
|
|
|
create(:clusters_applications_helm, :installed, cluster: cluster)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on an abac cluster' do
|
2019-03-05 08:33:09 -05:00
|
|
|
let(:cluster) { create(:cluster, :provided_by_gcp, :rbac_disabled, projects: [project]) }
|
2018-12-13 10:39:44 -05:00
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'shows info block and not be installable' do
|
2018-12-13 10:39:44 -05:00
|
|
|
page.within('.js-cluster-application-row-knative') do
|
2019-03-07 16:51:43 -05:00
|
|
|
expect(page).to have_css('.rbac-notice')
|
2018-12-13 10:39:44 -05:00
|
|
|
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on an rbac cluster' do
|
2019-03-05 08:33:09 -05:00
|
|
|
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
|
2018-12-13 10:39:44 -05:00
|
|
|
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'does not show callout block and be installable' do
|
2018-12-13 10:39:44 -05:00
|
|
|
page.within('.js-cluster-application-row-knative') do
|
2019-03-07 16:51:43 -05:00
|
|
|
expect(page).not_to have_css('.rbac-notice')
|
2018-12-13 10:39:44 -05:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
|
|
|
|
end
|
|
|
|
end
|
2019-03-05 08:33:09 -05:00
|
|
|
|
|
|
|
describe 'when user clicks install button' do
|
|
|
|
def domainname_form_value
|
|
|
|
page.find('.js-knative-domainname').value
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(ClusterInstallAppWorker).to receive(:perform_async)
|
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
|
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
|
|
|
|
|
|
|
|
page.within('.js-cluster-application-row-knative') do
|
|
|
|
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
|
|
|
|
|
|
|
|
page.find('.js-knative-domainname').set("domain.example.org")
|
|
|
|
|
|
|
|
click_button 'Install'
|
|
|
|
|
2019-03-06 07:48:45 -05:00
|
|
|
wait_for_requests
|
2019-03-05 08:33:09 -05:00
|
|
|
|
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
|
|
|
|
|
|
|
|
Clusters::Cluster.last.application_knative.make_installing!
|
|
|
|
Clusters::Cluster.last.application_knative.make_installed!
|
|
|
|
Clusters::Cluster.last.application_knative.update_attribute(:external_ip, '127.0.0.1')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows status transition' do
|
|
|
|
page.within('.js-cluster-application-row-knative') do
|
|
|
|
expect(domainname_form_value).to eq('domain.example.org')
|
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installed')
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('Knative was successfully installed on your Kubernetes cluster')
|
|
|
|
expect(page).to have_css('.js-knative-save-domain-button'), exact_text: 'Save changes'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'can then update the domain' do
|
|
|
|
page.within('.js-cluster-application-row-knative') do
|
2019-03-05 10:21:29 -05:00
|
|
|
expect(ClusterPatchAppWorker).to receive(:perform_async)
|
2019-03-05 08:33:09 -05:00
|
|
|
|
|
|
|
expect(domainname_form_value).to eq('domain.example.org')
|
|
|
|
|
|
|
|
page.find('.js-knative-domainname').set("new.domain.example.org")
|
|
|
|
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
2019-03-06 07:48:45 -05:00
|
|
|
wait_for_requests
|
2019-03-05 08:33:09 -05:00
|
|
|
|
|
|
|
expect(domainname_form_value).to eq('new.domain.example.org')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 10:39:44 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-07 11:10:03 -05:00
|
|
|
context 'when user installs Cert Manager' do
|
|
|
|
before do
|
|
|
|
allow(ClusterInstallAppWorker).to receive(:perform_async)
|
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
|
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
|
|
|
|
|
|
|
|
create(:clusters_applications_helm, :installed, cluster: cluster)
|
|
|
|
|
|
|
|
page.within('.js-cluster-application-row-cert_manager') do
|
|
|
|
click_button 'Install'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows status transition' do
|
|
|
|
def email_form_value
|
|
|
|
page.find('.js-email').value
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within('.js-cluster-application-row-cert_manager') do
|
|
|
|
expect(email_form_value).to eq(cluster.user.email)
|
2019-02-01 05:44:49 -05:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
|
2018-12-07 11:10:03 -05:00
|
|
|
|
|
|
|
page.find('.js-email').set("new_email@example.org")
|
|
|
|
Clusters::Cluster.last.application_cert_manager.make_installing!
|
|
|
|
|
|
|
|
expect(email_form_value).to eq('new_email@example.org')
|
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installing')
|
|
|
|
|
|
|
|
Clusters::Cluster.last.application_cert_manager.make_installed!
|
|
|
|
|
|
|
|
expect(email_form_value).to eq('new_email@example.org')
|
|
|
|
expect(page).to have_css('.js-cluster-application-install-button', exact_text: 'Installed')
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('Cert-Manager was successfully installed on your Kubernetes cluster')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-12-05 07:00:02 -05:00
|
|
|
context 'when user installs Ingress' do
|
|
|
|
context 'when user installs application: Ingress' do
|
|
|
|
before do
|
2018-02-22 19:46:32 -05:00
|
|
|
allow(ClusterInstallAppWorker).to receive(:perform_async)
|
2018-02-19 22:47:00 -05:00
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
|
2018-02-22 19:46:32 -05:00
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
|
2017-12-05 07:00:02 -05:00
|
|
|
|
2017-12-22 12:23:43 -05:00
|
|
|
create(:clusters_applications_helm, :installed, cluster: cluster)
|
2017-12-05 07:00:02 -05:00
|
|
|
|
|
|
|
page.within('.js-cluster-application-row-ingress') do
|
2018-02-28 19:59:44 -05:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
|
2017-12-05 07:00:02 -05:00
|
|
|
page.find(:css, '.js-cluster-application-install-button').click
|
2019-03-06 07:48:45 -05:00
|
|
|
|
|
|
|
wait_for_requests
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-07 08:39:38 -04:00
|
|
|
it 'they see status transition' do
|
2017-12-05 07:00:02 -05:00
|
|
|
page.within('.js-cluster-application-row-ingress') do
|
2019-02-01 05:44:49 -05:00
|
|
|
# FE sends request and gets the response, then the buttons is "Installing"
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
|
2017-12-05 07:00:02 -05:00
|
|
|
|
|
|
|
Clusters::Cluster.last.application_ingress.make_installing!
|
|
|
|
|
|
|
|
# FE starts polling and update the buttons to "Installing"
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installing')
|
2017-12-05 07:00:02 -05:00
|
|
|
|
2018-02-19 22:47:00 -05:00
|
|
|
# The application becomes installed but we keep waiting for external IP address
|
2017-12-05 07:00:02 -05:00
|
|
|
Clusters::Cluster.last.application_ingress.make_installed!
|
|
|
|
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).to have_css('.js-cluster-application-install-button[disabled]', exact_text: 'Installed')
|
2019-03-07 16:51:43 -05:00
|
|
|
expect(page).to have_selector('.js-no-endpoint-message')
|
2019-03-14 15:03:21 -04:00
|
|
|
expect(page).to have_selector('.js-ingress-ip-loading-icon')
|
2018-02-19 22:47:00 -05:00
|
|
|
|
|
|
|
# We receive the external IP address and display
|
|
|
|
Clusters::Cluster.last.application_ingress.update!(external_ip: '192.168.1.100')
|
|
|
|
|
2019-07-02 08:59:59 -04:00
|
|
|
expect(page).not_to have_css('.js-cluster-application-install-button')
|
|
|
|
expect(page).to have_css('.js-cluster-application-uninstall-button:not([disabled])', exact_text: 'Uninstall')
|
2019-03-07 16:51:43 -05:00
|
|
|
expect(page).not_to have_selector('.js-no-endpoint-message')
|
|
|
|
expect(page.find('.js-endpoint').value).to eq('192.168.1.100')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
|
2018-01-29 14:49:00 -05:00
|
|
|
expect(page).to have_content('Ingress was successfully installed on your Kubernetes cluster')
|
2017-12-05 07:00:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|