summaryrefslogtreecommitdiff
path: root/spec/models/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-25 18:08:55 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-25 18:08:55 +0000
commit1e3f5ab634699e9d50779f05d2ae8dfc8a3ab9b3 (patch)
treec96727e136f4dc4fdbc1190895439d41e0b07fc5 /spec/models/ci
parentba8e92f7c9938d7dba333d2396cdd14bfa0de726 (diff)
downloadgitlab-ce-1e3f5ab634699e9d50779f05d2ae8dfc8a3ab9b3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_spec.rb1
-rw-r--r--spec/models/ci/runner_spec.rb26
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 99326dfd02d..970717b1212 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -3842,6 +3842,7 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
'ID_TOKEN_1' => { aud: 'developers' },
'ID_TOKEN_2' => { aud: 'maintainers' }
})
+ build.runner = build_stubbed(:ci_runner)
end
subject(:runner_vars) { build.variables.to_runner_variables }
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 53a6a0e6a88..65c4174c1ea 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -2093,4 +2093,30 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do
end
end
end
+
+ describe '#gitlab_hosted?' do
+ using RSpec::Parameterized::TableSyntax
+
+ subject(:runner) { build_stubbed(:ci_runner) }
+
+ where(:saas, :runner_type, :expected_value) do
+ true | :instance_type | true
+ true | :group_type | false
+ true | :project_type | false
+ false | :instance_type | false
+ false | :group_type | false
+ false | :project_type | false
+ end
+
+ with_them do
+ before do
+ allow(Gitlab).to receive(:com?).and_return(saas)
+ runner.runner_type = runner_type
+ end
+
+ it 'returns the correct value based on saas and runner type' do
+ expect(runner.gitlab_hosted?).to eq(expected_value)
+ end
+ end
+ end
end