Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 03:13:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 03:13:04 +0300
commit2385fdce54c41a08e6421af12a567c7f00a0efb0 (patch)
treee00df2c29f935e5d0e252ca3a8071ba5d6dfa021 /spec/features/clusters
parentef2f70470a506a56f7a87d0ea3039a7417be2ebf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/clusters')
-rw-r--r--spec/features/clusters/create_agent_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/clusters/create_agent_spec.rb b/spec/features/clusters/create_agent_spec.rb
new file mode 100644
index 00000000000..d11684b910f
--- /dev/null
+++ b/spec/features/clusters/create_agent_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Cluster agent registration', :js do
+ let_it_be(:project) { create(:project, :custom_repo, files: { '.gitlab/agents/example-agent-1/config.yaml' => '' }) }
+ let_it_be(:current_user) { create(:user, maintainer_projects: [project]) }
+
+ before do
+ allow(Gitlab::Kas).to receive(:enabled?).and_return(true)
+ allow(Gitlab::Kas).to receive(:internal_url).and_return('kas.example.internal')
+
+ allow_next_instance_of(Gitlab::Kas::Client) do |client|
+ allow(client).to receive(:list_agent_config_files).and_return([
+ double(agent_name: 'example-agent-1', path: '.gitlab/agents/example-agent-1/config.yaml'),
+ double(agent_name: 'example-agent-2', path: '.gitlab/agents/example-agent-2/config.yaml')
+ ])
+ end
+
+ allow(Devise).to receive(:friendly_token).and_return('example-agent-token')
+
+ sign_in(current_user)
+ visit project_clusters_path(project)
+ end
+
+ it 'allows the user to select an agent to install, and displays the resulting agent token' do
+ click_link('GitLab Agent managed clusters')
+
+ click_button('Integrate with the GitLab Agent')
+ expect(page).to have_content('Install new Agent')
+
+ click_button('Select an Agent')
+ click_button('example-agent-2')
+ click_button('Next')
+
+ expect(page).to have_content('The token value will not be shown again after you close this window.')
+ expect(page).to have_content('example-agent-token')
+ expect(page).to have_content('docker run --pull=always --rm')
+
+ click_button('Done')
+ expect(page).to have_link('example-agent-2')
+ expect(page).to have_no_content('Install new Agent')
+ end
+end