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:
Diffstat (limited to 'spec/models/ci/runner_spec.rb')
-rw-r--r--spec/models/ci/runner_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 13eb7086586..803b766c822 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Ci::Runner do
+RSpec.describe Ci::Runner, feature_category: :runner do
include StubGitlabCalls
it_behaves_like 'having unique enum values'
@@ -701,6 +701,30 @@ RSpec.describe Ci::Runner do
it { is_expected.to eq([runner1]) }
end
+ describe '.with_running_builds' do
+ subject { described_class.with_running_builds }
+
+ let_it_be(:runner1) { create(:ci_runner) }
+
+ context 'with no builds running' do
+ it { is_expected.to be_empty }
+ end
+
+ context 'with single build running on runner2' do
+ let(:runner2) { create(:ci_runner) }
+ let(:runner3) { create(:ci_runner) }
+
+ before do
+ project = create(:project, :repository)
+ pipeline = create(:ci_pipeline, project: project)
+ create(:ci_build, :running, runner: runner2, pipeline: pipeline)
+ create(:ci_build, :running, runner: runner3, pipeline: pipeline)
+ end
+
+ it { is_expected.to contain_exactly(runner2, runner3) }
+ end
+ end
+
describe '#matches_build?' do
using RSpec::Parameterized::TableSyntax