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>2023-06-20 12:10:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-20 12:10:41 +0300
commitedf0e5b64384499283b406f9087e890ac4fad13f (patch)
tree5b634c08f9324749ee06b85334e2fad8340092ac /spec/models
parentdd4c30182c16fe27efbbf4c19594bb292fb4ac48 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/runner_manager_spec.rb43
-rw-r--r--spec/models/integrations/unify_circuit_spec.rb2
2 files changed, 44 insertions, 1 deletions
diff --git a/spec/models/ci/runner_manager_spec.rb b/spec/models/ci/runner_manager_spec.rb
index d69c9ef845e..80cffb98dff 100644
--- a/spec/models/ci/runner_manager_spec.rb
+++ b/spec/models/ci/runner_manager_spec.rb
@@ -69,6 +69,49 @@ RSpec.describe Ci::RunnerManager, feature_category: :runner_fleet, type: :model
it { is_expected.to eq(7.days.ago) }
end
+ describe '.for_runner' do
+ subject(:runner_managers) { described_class.for_runner(runner_arg) }
+
+ let_it_be(:runner1) { create(:ci_runner) }
+ let_it_be(:runner_manager11) { create(:ci_runner_machine, runner: runner1) }
+ let_it_be(:runner_manager12) { create(:ci_runner_machine, runner: runner1) }
+
+ context 'with single runner' do
+ let(:runner_arg) { runner1 }
+
+ it { is_expected.to contain_exactly(runner_manager11, runner_manager12) }
+ end
+
+ context 'with multiple runners' do
+ let(:runner_arg) { [runner1, runner2] }
+
+ let_it_be(:runner2) { create(:ci_runner) }
+ let_it_be(:runner_manager2) { create(:ci_runner_machine, runner: runner2) }
+
+ it { is_expected.to contain_exactly(runner_manager11, runner_manager12, runner_manager2) }
+ end
+ end
+
+ describe '.aggregate_upgrade_status_by_runner_id' do
+ let!(:runner_version1) { create(:ci_runner_version, version: '16.0.0', status: :recommended) }
+ let!(:runner_version2) { create(:ci_runner_version, version: '16.0.1', status: :available) }
+
+ let!(:runner1) { create(:ci_runner) }
+ let!(:runner2) { create(:ci_runner) }
+ let!(:runner_manager11) { create(:ci_runner_machine, runner: runner1, version: runner_version1.version) }
+ let!(:runner_manager12) { create(:ci_runner_machine, runner: runner1, version: runner_version2.version) }
+ let!(:runner_manager2) { create(:ci_runner_machine, runner: runner2, version: runner_version2.version) }
+
+ subject { described_class.aggregate_upgrade_status_by_runner_id }
+
+ it 'contains aggregate runner upgrade status by runner ID' do
+ is_expected.to eq({
+ runner1.id => :recommended,
+ runner2.id => :available
+ })
+ end
+ end
+
describe '#status', :freeze_time do
let(:runner_manager) { build(:ci_runner_machine, created_at: 8.days.ago) }
diff --git a/spec/models/integrations/unify_circuit_spec.rb b/spec/models/integrations/unify_circuit_spec.rb
index 7a91b2d3c11..017443c799f 100644
--- a/spec/models/integrations/unify_circuit_spec.rb
+++ b/spec/models/integrations/unify_circuit_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-RSpec.describe Integrations::UnifyCircuit do
+RSpec.describe Integrations::UnifyCircuit, feature_category: :integrations do
it_behaves_like "chat integration", "Unify Circuit" do
let(:client_arguments) { webhook_url }
let(:payload) do