diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb')
-rw-r--r-- | spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb b/spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb new file mode 100644 index 00000000000..e0390d2aa09 --- /dev/null +++ b/spec/tasks/gitlab/seed/runner_fleet_rake_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'rake_helper' + +RSpec.describe 'gitlab:seed:runner_fleet rake task', :silence_stdout, feature_category: :runner_fleet do + let(:registration_prefix) { 'rf-' } + let(:runner_count) { 10 } + let(:job_count) { 20 } + let(:task_params) { [username, registration_prefix, runner_count, job_count] } + let(:runner_releases_url) do + ::Gitlab::CurrentSettings.current_application_settings.public_runner_releases_url + end + + before do + Rake.application.rake_require('tasks/gitlab/seed/runner_fleet') + + WebMock.stub_request(:get, runner_releases_url).to_return( + body: '[]', + status: 200, + headers: { 'Content-Type' => 'application/json' } + ) + end + + subject(:rake_task) { run_rake_task('gitlab:seed:runner_fleet', task_params) } + + context 'with admin username', :enable_admin_mode do + let(:username) { 'runner_fleet_seed' } + let!(:admin) { create(:user, :admin, username: username) } + + it 'performs runner fleet seed successfully' do + expect { rake_task } + .to change { Group.count }.by(6) + .and change { Project.count }.by(3) + .and change { Ci::Runner.count }.by(runner_count) + .and change { Ci::Runner.instance_type.count }.by(1) + .and change { Ci::Build.count }.by(job_count) + + expect(Group.search(registration_prefix).count).to eq 6 + expect(Project.search(registration_prefix).count).to eq 3 + expect(Ci::Runner.search(registration_prefix).count).to eq runner_count + end + end +end |