diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-05 12:08:03 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-05 12:08:03 +0000 |
commit | 3c86701bc89302550abb9bbaa060132fdcd52480 (patch) | |
tree | b73328cbd2de6d43afd0eb5253ec215274011dc8 /spec/features/projects | |
parent | 17ef30f3df6d3939e41e69efc7cfa3deaa08605d (diff) | |
download | gitlab-ce-3c86701bc89302550abb9bbaa060132fdcd52480.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/clusters/eks_spec.rb | 36 | ||||
-rw-r--r-- | spec/features/projects/clusters/gcp_spec.rb | 95 | ||||
-rw-r--r-- | spec/features/projects/clusters_spec.rb | 97 |
3 files changed, 2 insertions, 226 deletions
diff --git a/spec/features/projects/clusters/eks_spec.rb b/spec/features/projects/clusters/eks_spec.rb deleted file mode 100644 index 7e599ff1198..00000000000 --- a/spec/features/projects/clusters/eks_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'AWS EKS Cluster', :js do - let(:project) { create(:project) } - let(:user) { create(:user) } - - before do - project.add_maintainer(user) - gitlab_sign_in(user) - allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } - stub_application_setting(eks_integration_enabled: true) - end - - context 'when user does not have a cluster and visits cluster index page' do - let(:project_id) { 'test-project-1234' } - - before do - visit project_clusters_path(project) - - click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (certificate - deprecated)' - end - - context 'when user creates a cluster on AWS EKS' do - before do - click_link 'Amazon EKS' - end - - it 'highlights Amazon EKS logo' do - expect(page).to have_css('.js-create-aws-cluster-button.active') - end - end - end -end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 491121a3743..a8a23ba1c85 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -14,11 +14,6 @@ RSpec.describe 'Gcp Cluster', :js do allow(Projects::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } end - def submit_form - execute_script('document.querySelector(".js-gke-cluster-creation-submit").removeAttribute("disabled")') - execute_script('document.querySelector(".js-gke-cluster-creation-submit").click()') - end - context 'when user has signed with Google' do let(:project_id) { 'test-project-1234' } @@ -29,82 +24,7 @@ RSpec.describe 'Gcp Cluster', :js do .to receive(:expires_at_in_session).and_return(1.hour.since.to_i.to_s) end - context 'when user does not have a cluster and visits cluster index page' do - before do - visit project_clusters_path(project) - - visit_create_cluster_page - click_link 'Google GKE' - end - - it 'highlights Google GKE logo' do - expect(page).to have_css('.js-create-gcp-cluster-button.active') - end - - context 'when user filled form with valid parameters' do - subject { submit_form } - - before do - allow_any_instance_of(GoogleApi::CloudPlatform::Client) - .to receive(:projects_zones_clusters_create) do - double( - 'cluster', - self_link: 'projects/gcp-project-12345/zones/us-central1-a/operations/ope-123', - status: 'RUNNING' - ) - end - - allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil) - - expect(page).to have_css('.js-gcp-project-id-dropdown') - - execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-zone-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-machine-type-dropdown input").setAttribute("type", "text")') - - fill_in 'cluster[name]', with: 'dev-cluster' - fill_in 'cluster[provider_gcp_attributes][gcp_project_id]', with: 'gcp-project-123' - fill_in 'cluster[provider_gcp_attributes][zone]', with: 'us-central1-a' - fill_in 'cluster[provider_gcp_attributes][machine_type]', with: 'n1-standard-2' - end - - it 'users sees a form with the GCP token' do - expect(page).to have_selector(:css, 'form[data-token="token"]') - end - - it 'user sees a cluster details page and creation status' do - subject - - expect(page).to have_content('Kubernetes cluster is being created...') - - Clusters::Cluster.last.provider.make_created! - - expect(page).to have_content('Kubernetes cluster was successfully created') - end - - it 'user sees a error if something wrong during creation' do - subject - - expect(page).to have_content('Kubernetes cluster is being created...') - - Clusters::Cluster.last.provider.make_errored!('Something wrong!') - - expect(page).to have_content('Something wrong!') - end - end - - context 'when user filled form with invalid parameters' do - before do - submit_form - end - - it 'user sees a validation error' do - expect(page).to have_css('.gl-field-error') - end - end - end - - context 'when user does have a cluster and visits cluster page' do + context 'when user have a cluster and visits cluster page' do let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } before do @@ -167,12 +87,6 @@ RSpec.describe 'Gcp Cluster', :js do it 'user sees offer on cluster index page' do expect(page).to have_css('.gcp-signup-offer') end - - it 'user sees offer on cluster create page' do - visit_create_cluster_page - - expect(page).to have_css('.gcp-signup-offer') - end end context 'when user has dismissed GCP signup offer' do @@ -187,8 +101,6 @@ RSpec.describe 'Gcp Cluster', :js do find('.gcp-signup-offer .js-close').click wait_for_requests - visit_create_cluster_page - expect(page).not_to have_css('.gcp-signup-offer') end end @@ -216,9 +128,4 @@ RSpec.describe 'Gcp Cluster', :js do expect(page).not_to have_css('.gcp-signup-offer') end end - - def visit_create_cluster_page - click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (certificate - deprecated)' - end end diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index 0ecd7795964..9e1d66bc73e 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -81,101 +81,6 @@ RSpec.describe 'Clusters', :js do end end end - - context 'when user adds a Google Kubernetes Engine cluster' do - before do - allow_any_instance_of(Projects::ClustersController) - .to receive(:token_in_session).and_return('token') - allow_any_instance_of(Projects::ClustersController) - .to receive(:expires_at_in_session).and_return(1.hour.since.to_i.to_s) - - allow_any_instance_of(Projects::ClustersController).to receive(:authorize_google_project_billing) - allow_any_instance_of(Projects::ClustersController).to receive(:google_project_billing_status).and_return(true) - - allow_any_instance_of(GoogleApi::CloudPlatform::Client) - .to receive(:projects_zones_clusters_create) do - double( - 'cluster_control', - self_link: 'projects/gcp-project-12345/zones/us-central1-a/operations/ope-123', - status: 'RUNNING' - ) - end - - allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil) - - create(:cluster, :provided_by_gcp, name: 'default-cluster', environment_scope: '*', projects: [project]) - visit project_clusters_path(project) - click_link 'Certificate' - end - - context 'when user filled form with environment scope' do - before do - visit_create_cluster_page - click_link 'Google GKE' - - sleep 2 # wait for ajax - execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-zone-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-machine-type-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gke-cluster-creation-submit").removeAttribute("disabled")') - - fill_in 'cluster_name', with: 'staging-cluster' - fill_in 'cluster_environment_scope', with: 'staging/*' - fill_in 'cluster[provider_gcp_attributes][gcp_project_id]', with: 'gcp-project-123' - fill_in 'cluster[provider_gcp_attributes][zone]', with: 'us-central1-a' - fill_in 'cluster[provider_gcp_attributes][machine_type]', with: 'n1-standard-2' - click_button 'Create Kubernetes cluster' - - # The frontend won't show the details until the cluster is - # created, and we don't want to make calls out to GCP. - provider = Clusters::Cluster.last.provider - provider.make_created - end - - it 'user sees a cluster details page' do - expect(page).to have_content('GitLab Integration') - expect(page.find_field('cluster[environment_scope]').value).to eq('staging/*') - end - end - - context 'when user updates environment scope' do - before do - click_link 'default-cluster' - fill_in 'cluster_environment_scope', with: 'production/*' - within ".js-cluster-details-form" do - click_button 'Save changes' - end - end - - it 'updates the environment scope' do - expect(page.find_field('cluster[environment_scope]').value).to eq('production/*') - end - end - - context 'when user updates duplicated environment scope' do - before do - visit_create_cluster_page - click_link 'Google GKE' - - sleep 2 # wait for ajax - execute_script('document.querySelector(".js-gcp-project-id-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-zone-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gcp-machine-type-dropdown input").setAttribute("type", "text")') - execute_script('document.querySelector(".js-gke-cluster-creation-submit").removeAttribute("disabled")') - - fill_in 'cluster_name', with: 'staging-cluster' - fill_in 'cluster_environment_scope', with: '*' - fill_in 'cluster[provider_gcp_attributes][gcp_project_id]', with: 'gcp-project-123' - fill_in 'cluster[provider_gcp_attributes][zone]', with: 'us-central1-a' - fill_in 'cluster[provider_gcp_attributes][machine_type]', with: 'n1-standard-2' - click_button 'Create Kubernetes cluster' - end - - it 'users sees an environment scope validation error' do - expect(page).to have_content('cannot add duplicated environment scope') - end - end - end end context 'when user has a cluster and visits cluster index page' do @@ -221,7 +126,7 @@ RSpec.describe 'Clusters', :js do visit project_clusters_path(project) click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (certificate - deprecated)' + click_link 'Create a cluster' end def visit_connect_cluster_page |