Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
aa1ab8aa
Commit
aa1ab8aa
authored
Oct 03, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some tests for updating ci runner information
parent
9a8e4863
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+27
-16
No files found.
spec/requests/ci/api/builds_spec.rb
View file @
aa1ab8aa
...
@@ -35,18 +35,24 @@ describe Ci::API::API do
...
@@ -35,18 +35,24 @@ describe Ci::API::API do
end
end
end
end
it
"starts a build"
do
context
'when there is a pending build'
do
register_builds
info:
{
platform: :darwin
}
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'sha'
]).
to
eq
(
build
.
sha
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
runner
.
reload
.
platform
).
to
eq
(
"darwin"
)
expect
(
json_response
[
'sha'
]).
to
eq
(
build
.
sha
)
expect
(
json_response
[
"options"
]).
to
eq
({
"image"
=>
"ruby:2.1"
,
"services"
=>
[
"postgres"
]
})
expect
(
runner
.
reload
.
platform
).
to
eq
(
"darwin"
)
expect
(
json_response
[
"variables"
]).
to
include
(
expect
(
json_response
[
"options"
]).
to
eq
({
"image"
=>
"ruby:2.1"
,
"services"
=>
[
"postgres"
]
})
{
"key"
=>
"CI_BUILD_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
expect
(
json_response
[
"variables"
]).
to
include
(
{
"key"
=>
"CI_BUILD_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
{
"key"
=>
"CI_BUILD_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
{
"key"
=>
"DB_NAME"
,
"value"
=>
"postgres"
,
"public"
=>
true
}
{
"key"
=>
"CI_BUILD_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
)
{
"key"
=>
"DB_NAME"
,
"value"
=>
"postgres"
,
"public"
=>
true
}
)
end
it
'updates runner info'
do
expect
{
register_builds
}.
to
change
{
runner
.
reload
.
contacted_at
}
end
end
end
context
'when builds are finished'
do
context
'when builds are finished'
do
...
@@ -159,13 +165,18 @@ describe Ci::API::API do
...
@@ -159,13 +165,18 @@ describe Ci::API::API do
end
end
context
'when runner is paused'
do
context
'when runner is paused'
do
let
(
:
inactive_runner
)
{
create
(
:ci_runner
,
:inactive
,
token:
"InactiveRunner"
)
}
let
(
:
runner
)
{
create
(
:ci_runner
,
:inactive
,
token:
'InactiveRunner'
)
}
before
do
it
'responds with 404'
do
register_builds
inactive_runner
.
token
register_builds
expect
(
response
).
to
have_http_status
404
end
end
it
{
expect
(
response
).
to
have_http_status
404
}
it
'does not update runner info'
do
expect
{
register_builds
}
.
not_to
change
{
runner
.
reload
.
contacted_at
}
end
end
end
def
register_builds
(
token
=
runner
.
token
,
**
params
)
def
register_builds
(
token
=
runner
.
token
,
**
params
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment