summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorzelin-l <16577660+zelin-l@users.noreply.github.com>2019-04-18 09:06:53 -0400
committerzelin-l <16577660+zelin-l@users.noreply.github.com>2019-04-18 09:57:12 -0400
commit52c19d4da7830c9c39d23190822d3c2de80d13a4 (patch)
tree17300e81a46eb58a072855388702fe908be176b7 /spec/requests
parent7a4b4cffba0313ada14b012dae05f31ecb17154d (diff)
downloadgitlab-ce-52c19d4da7830c9c39d23190822d3c2de80d13a4.tar.gz
Add configuration of access_level for runners on registration via API
Allow setting access_level of new runner to not_protected (default) or ref_protected Minor update to relevant docs and tests
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/runner_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb
index 3585a827838..29515709a74 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/spec/requests/api/runner_spec.rb
@@ -168,6 +168,32 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
end
end
+ context 'when access_level is provided for Runner' do
+ context 'when access_level is set to ref_protected' do
+ it 'creates runner' do
+ post api('/runners'), params: {
+ token: registration_token,
+ access_level: 'ref_protected'
+ }
+
+ expect(response).to have_gitlab_http_status 201
+ expect(Ci::Runner.first.ref_protected?).to be true
+ end
+ end
+
+ context 'when access_level is set to not_protected' do
+ it 'creates runner' do
+ post api('/runners'), params: {
+ token: registration_token,
+ access_level: 'not_protected'
+ }
+
+ expect(response).to have_gitlab_http_status 201
+ expect(Ci::Runner.first.ref_protected?).to be false
+ end
+ end
+ end
+
context 'when maximum job timeout is specified' do
it 'creates runner' do
post api('/runners'), params: {