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
4f827d1e
Commit
4f827d1e
authored
Jul 11, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-07-11
# Conflicts: # locale/gitlab.pot [ci skip]
parents
4cefac10
eae40e70
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
243 additions
and
108 deletions
+243
-108
app/helpers/pipeline_schedules_helper.rb
app/helpers/pipeline_schedules_helper.rb
+1
-1
app/workers/git_garbage_collect_worker.rb
app/workers/git_garbage_collect_worker.rb
+2
-2
changelogs/unreleased/add-dst-support-to-pipeline-schedule.yml
...elogs/unreleased/add-dst-support-to-pipeline-schedule.yml
+5
-0
changelogs/unreleased/runners-max-timeout-param.yml
changelogs/unreleased/runners-max-timeout-param.yml
+5
-0
changelogs/unreleased/sh-handle-colons-in-url-passwords.yml
changelogs/unreleased/sh-handle-colons-in-url-passwords.yml
+5
-0
doc/development/what_requires_downtime.md
doc/development/what_requires_downtime.md
+2
-2
lib/api/runners.rb
lib/api/runners.rb
+1
-1
lib/declarative_policy.rb
lib/declarative_policy.rb
+11
-1
lib/gitlab/url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+1
-1
lib/tasks/gettext.rake
lib/tasks/gettext.rake
+7
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/javascripts/helpers/wait_for_promises.js
spec/javascripts/helpers/wait_for_promises.js
+1
-0
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+12
-15
spec/javascripts/smart_interval_spec.js
spec/javascripts/smart_interval_spec.js
+117
-84
spec/lib/gitlab/url_sanitizer_spec.rb
spec/lib/gitlab/url_sanitizer_spec.rb
+1
-0
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+63
-0
spec/workers/git_garbage_collect_worker_spec.rb
spec/workers/git_garbage_collect_worker_spec.rb
+6
-0
No files found.
app/helpers/pipeline_schedules_helper.rb
View file @
4f827d1e
...
@@ -3,7 +3,7 @@ module PipelineSchedulesHelper
...
@@ -3,7 +3,7 @@ module PipelineSchedulesHelper
ActiveSupport
::
TimeZone
.
all
.
map
do
|
timezone
|
ActiveSupport
::
TimeZone
.
all
.
map
do
|
timezone
|
{
{
name:
timezone
.
name
,
name:
timezone
.
name
,
offset:
timezone
.
utc_offset
,
offset:
timezone
.
now
.
utc_offset
,
identifier:
timezone
.
tzinfo
.
identifier
identifier:
timezone
.
tzinfo
.
identifier
}
}
end
end
...
...
app/workers/git_garbage_collect_worker.rb
View file @
4f827d1e
...
@@ -65,10 +65,10 @@ class GitGarbageCollectWorker
...
@@ -65,10 +65,10 @@ class GitGarbageCollectWorker
client
.
repack_incremental
client
.
repack_incremental
end
end
rescue
GRPC
::
NotFound
=>
e
rescue
GRPC
::
NotFound
=>
e
Gitlab
::
GitLogger
.
error
(
"
#{
method
}
failed:
\n
Repository not found"
)
Gitlab
::
GitLogger
.
error
(
"
#{
__method__
}
failed:
\n
Repository not found"
)
raise
Gitlab
::
Git
::
Repository
::
NoRepository
.
new
(
e
)
raise
Gitlab
::
Git
::
Repository
::
NoRepository
.
new
(
e
)
rescue
GRPC
::
BadStatus
=>
e
rescue
GRPC
::
BadStatus
=>
e
Gitlab
::
GitLogger
.
error
(
"
#{
method
}
failed:
\n
#{
e
}
"
)
Gitlab
::
GitLogger
.
error
(
"
#{
__method__
}
failed:
\n
#{
e
}
"
)
raise
Gitlab
::
Git
::
CommandError
.
new
(
e
)
raise
Gitlab
::
Git
::
CommandError
.
new
(
e
)
end
end
...
...
changelogs/unreleased/add-dst-support-to-pipeline-schedule.yml
0 → 100644
View file @
4f827d1e
---
title
:
Add support for daylight savings time to pipleline schedules
merge_request
:
20145
author
:
type
:
fixed
changelogs/unreleased/runners-max-timeout-param.yml
0 → 100644
View file @
4f827d1e
---
title
:
Add missing maximum_timeout parameter
merge_request
:
20355
author
:
gfyoung
type
:
fixed
changelogs/unreleased/sh-handle-colons-in-url-passwords.yml
0 → 100644
View file @
4f827d1e
---
title
:
Properly handle colons in URL passwords
merge_request
:
author
:
type
:
fixed
doc/development/what_requires_downtime.md
View file @
4f827d1e
...
@@ -198,14 +198,14 @@ And that's it, we're done!
...
@@ -198,14 +198,14 @@ And that's it, we're done!
## Changing The Schema For Large Tables
## Changing The Schema For Large Tables
While
`change_column_type_concurrently`
and
`rename_column_concurrently`
can be
While
`change_column_type_concurrently`
and
`rename_column_concurrently`
can be
used for changing the schema of a table without downtime it doesn't work very
used for changing the schema of a table without downtime
,
it doesn't work very
well for large tables. Because all of the work happens in sequence the migration
well for large tables. Because all of the work happens in sequence the migration
can take a very long time to complete, preventing a deployment from proceeding.
can take a very long time to complete, preventing a deployment from proceeding.
They can also produce a lot of pressure on the database due to it rapidly
They can also produce a lot of pressure on the database due to it rapidly
updating many rows in sequence.
updating many rows in sequence.
To reduce database pressure you should instead use
To reduce database pressure you should instead use
`change_column_type_using_background_migration`
or
`rename_column_
concurrently
`
`change_column_type_using_background_migration`
or
`rename_column_
using_background_migration
`
when migrating a column in a large table (e.g.
`issues`
). These methods work
when migrating a column in a large table (e.g.
`issues`
). These methods work
similarly to the concurrent counterparts but uses background migration to spread
similarly to the concurrent counterparts but uses background migration to spread
the work / load over a longer time period, without slowing down deployments.
the work / load over a longer time period, without slowing down deployments.
...
...
lib/api/runners.rb
View file @
4f827d1e
...
@@ -58,7 +58,7 @@ module API
...
@@ -58,7 +58,7 @@ module API
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
optional
:access_level
,
type:
String
,
values:
Ci
::
Runner
.
access_levels
.
keys
,
desc:
'The access_level of the runner'
desc:
'The access_level of the runner'
optional
:maximum_timeout
,
type:
Integer
,
desc:
'Maximum timeout set when this Runner will handle the job'
optional
:maximum_timeout
,
type:
Integer
,
desc:
'Maximum timeout set when this Runner will handle the job'
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
at_least_one_of
:description
,
:active
,
:tag_list
,
:run_untagged
,
:locked
,
:access_level
,
:maximum_timeout
end
end
put
':id'
do
put
':id'
do
runner
=
get_runner
(
params
.
delete
(
:id
))
runner
=
get_runner
(
params
.
delete
(
:id
))
...
...
lib/declarative_policy.rb
View file @
4f827d1e
...
@@ -21,7 +21,17 @@ module DeclarativePolicy
...
@@ -21,7 +21,17 @@ module DeclarativePolicy
cache
=
opts
[
:cache
]
||
{}
cache
=
opts
[
:cache
]
||
{}
key
=
Cache
.
policy_key
(
user
,
subject
)
key
=
Cache
.
policy_key
(
user
,
subject
)
cache
[
key
]
||=
class_for
(
subject
).
new
(
user
,
subject
,
opts
)
cache
[
key
]
||=
if
Gitlab
.
rails5?
# to avoid deadlocks in multi-threaded environment when
# autoloading is enabled, we allow concurrent loads,
# https://gitlab.com/gitlab-org/gitlab-ce/issues/48263
ActiveSupport
::
Dependencies
.
interlock
.
permit_concurrent_loads
do
class_for
(
subject
).
new
(
user
,
subject
,
opts
)
end
else
class_for
(
subject
).
new
(
user
,
subject
,
opts
)
end
end
end
def
class_for
(
subject
)
def
class_for
(
subject
)
...
...
lib/gitlab/url_sanitizer.rb
View file @
4f827d1e
...
@@ -58,7 +58,7 @@ module Gitlab
...
@@ -58,7 +58,7 @@ module Gitlab
if
raw_credentials
.
present?
if
raw_credentials
.
present?
url
.
sub!
(
"
#{
raw_credentials
}
@"
,
''
)
url
.
sub!
(
"
#{
raw_credentials
}
@"
,
''
)
user
,
password
=
raw_credentials
.
split
(
':'
)
user
,
_
,
password
=
raw_credentials
.
partition
(
':'
)
@credentials
||=
{
user:
user
.
presence
,
password:
password
.
presence
}
@credentials
||=
{
user:
user
.
presence
,
password:
password
.
presence
}
end
end
...
...
lib/tasks/gettext.rake
View file @
4f827d1e
...
@@ -20,16 +20,22 @@ namespace :gettext do
...
@@ -20,16 +20,22 @@ namespace :gettext do
end
end
task
:regenerate
do
task
:regenerate
do
pot_file
=
'locale/gitlab.pot'
# Remove all translated files, this speeds up finding
# Remove all translated files, this speeds up finding
FileUtils
.
rm
Dir
[
'locale/**/gitlab.*'
]
FileUtils
.
rm
Dir
[
'locale/**/gitlab.*'
]
# remove the `pot` file to ensure it's completely regenerated
# remove the `pot` file to ensure it's completely regenerated
FileUtils
.
rm_f
'locale/gitlab.pot'
FileUtils
.
rm_f
pot_file
Rake
::
Task
[
'gettext:find'
].
invoke
Rake
::
Task
[
'gettext:find'
].
invoke
# leave only the required changes.
# leave only the required changes.
`git checkout -- locale/*/gitlab.po`
`git checkout -- locale/*/gitlab.po`
# Remove timestamps from the pot file
pot_content
=
File
.
read
pot_file
pot_content
.
gsub!
(
/^"POT?\-(?:Creation|Revision)\-Date\:.*\n/
,
''
)
File
.
write
pot_file
,
pot_content
puts
<<~
MSG
puts
<<~
MSG
All done. Please commit the changes to `locale/gitlab.pot`.
All done. Please commit the changes to `locale/gitlab.pot`.
...
...
locale/gitlab.pot
View file @
4f827d1e
...
@@ -8,8 +8,11 @@ msgid ""
...
@@ -8,8 +8,11 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: gitlab 1.0.0\n"
"Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
<<<<<<< HEAD
"POT-Creation-Date: 2018-07-10 13:57-0500\n"
"POT-Creation-Date: 2018-07-10 13:57-0500\n"
"PO-Revision-Date: 2018-07-10 13:57-0500\n"
"PO-Revision-Date: 2018-07-10 13:57-0500\n"
=======
>>>>>>> upstream/master
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"Language: \n"
...
...
spec/javascripts/helpers/wait_for_promises.js
0 → 100644
View file @
4f827d1e
export
default
()
=>
new
Promise
(
resolve
=>
requestAnimationFrame
(
resolve
));
spec/javascripts/job_spec.js
View file @
4f827d1e
...
@@ -5,6 +5,7 @@ import { numberToHumanSize } from '~/lib/utils/number_utils';
...
@@ -5,6 +5,7 @@ import { numberToHumanSize } from '~/lib/utils/number_utils';
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
Job
from
'
~/job
'
;
import
Job
from
'
~/job
'
;
import
'
~/breakpoints
'
;
import
'
~/breakpoints
'
;
import
waitForPromises
from
'
spec/helpers/wait_for_promises
'
;
describe
(
'
Job
'
,
()
=>
{
describe
(
'
Job
'
,
()
=>
{
const
JOB_URL
=
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/builds-project/-/jobs/1`
;
const
JOB_URL
=
`
${
gl
.
TEST_HOST
}
/frontend-fixtures/builds-project/-/jobs/1`
;
...
@@ -12,10 +13,6 @@ describe('Job', () => {
...
@@ -12,10 +13,6 @@ describe('Job', () => {
let
response
;
let
response
;
let
job
;
let
job
;
function
waitForPromise
()
{
return
new
Promise
(
resolve
=>
requestAnimationFrame
(
resolve
));
}
preloadFixtures
(
'
builds/build-with-artifacts.html.raw
'
);
preloadFixtures
(
'
builds/build-with-artifacts.html.raw
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -49,7 +46,7 @@ describe('Job', () => {
...
@@ -49,7 +46,7 @@ describe('Job', () => {
beforeEach
(
function
(
done
)
{
beforeEach
(
function
(
done
)
{
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
...
@@ -93,7 +90,7 @@ describe('Job', () => {
...
@@ -93,7 +90,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Update/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Update/
);
expect
(
job
.
state
).
toBe
(
'
newstate
'
);
expect
(
job
.
state
).
toBe
(
'
newstate
'
);
...
@@ -107,7 +104,7 @@ describe('Job', () => {
...
@@ -107,7 +104,7 @@ describe('Job', () => {
};
};
})
})
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(
waitForPromise
)
.
then
(
waitForPromise
s
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/UpdateMore/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/UpdateMore/
);
expect
(
job
.
state
).
toBe
(
'
finalstate
'
);
expect
(
job
.
state
).
toBe
(
'
finalstate
'
);
...
@@ -126,7 +123,7 @@ describe('Job', () => {
...
@@ -126,7 +123,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Update/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Update/
);
...
@@ -137,7 +134,7 @@ describe('Job', () => {
...
@@ -137,7 +134,7 @@ describe('Job', () => {
};
};
})
})
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(
waitForPromise
)
.
then
(
waitForPromise
s
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
not
.
toMatch
(
/Update/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
not
.
toMatch
(
/Update/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Different/
);
expect
(
$
(
'
#build-trace .js-build-output
'
).
text
()).
toMatch
(
/Different/
);
...
@@ -160,7 +157,7 @@ describe('Job', () => {
...
@@ -160,7 +157,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
document
.
querySelector
(
'
.js-truncated-info
'
).
classList
).
not
.
toContain
(
'
hidden
'
);
expect
(
document
.
querySelector
(
'
.js-truncated-info
'
).
classList
).
not
.
toContain
(
'
hidden
'
);
})
})
...
@@ -181,7 +178,7 @@ describe('Job', () => {
...
@@ -181,7 +178,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
...
@@ -203,7 +200,7 @@ describe('Job', () => {
...
@@ -203,7 +200,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
...
@@ -219,7 +216,7 @@ describe('Job', () => {
...
@@ -219,7 +216,7 @@ describe('Job', () => {
};
};
})
})
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(()
=>
jasmine
.
clock
().
tick
(
4001
))
.
then
(
waitForPromise
)
.
then
(
waitForPromise
s
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
expect
(
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
document
.
querySelector
(
'
.js-truncated-info-size
'
).
textContent
.
trim
(),
...
@@ -258,7 +255,7 @@ describe('Job', () => {
...
@@ -258,7 +255,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
document
.
querySelector
(
'
.js-truncated-info
'
).
classList
).
toContain
(
'
hidden
'
);
expect
(
document
.
querySelector
(
'
.js-truncated-info
'
).
classList
).
toContain
(
'
hidden
'
);
})
})
...
@@ -280,7 +277,7 @@ describe('Job', () => {
...
@@ -280,7 +277,7 @@ describe('Job', () => {
job
=
new
Job
();
job
=
new
Job
();
waitForPromise
()
waitForPromise
s
()
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
...
...
spec/javascripts/smart_interval_spec.js
View file @
4f827d1e
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
SmartInterval
from
'
~/smart_interval
'
;
import
SmartInterval
from
'
~/smart_interval
'
;
import
waitForPromises
from
'
spec/helpers/wait_for_promises
'
;
describe
(
'
SmartInterval
'
,
function
()
{
describe
(
'
SmartInterval
'
,
function
()
{
const
DEFAULT_MAX_INTERVAL
=
100
;
const
DEFAULT_MAX_INTERVAL
=
100
;
const
DEFAULT_STARTING_INTERVAL
=
5
;
const
DEFAULT_STARTING_INTERVAL
=
5
;
const
DEFAULT_SHORT_TIMEOUT
=
75
;
const
DEFAULT_SHORT_TIMEOUT
=
75
;
const
DEFAULT_LONG_TIMEOUT
=
1000
;
const
DEFAULT_INCREMENT_FACTOR
=
2
;
const
DEFAULT_INCREMENT_FACTOR
=
2
;
function
createDefaultSmartInterval
(
config
)
{
function
createDefaultSmartInterval
(
config
)
{
...
@@ -27,52 +27,65 @@ describe('SmartInterval', function () {
...
@@ -27,52 +27,65 @@ describe('SmartInterval', function () {
return
new
SmartInterval
(
defaultParams
);
return
new
SmartInterval
(
defaultParams
);
}
}
describe
(
'
Increment Interval
'
,
function
()
{
beforeEach
(()
=>
{
beforeEach
(
function
()
{
jasmine
.
clock
().
install
();
this
.
smartInterval
=
createDefaultSmartInterval
();
});
});
it
(
'
should increment the interval delay
'
,
function
(
done
)
{
afterEach
(()
=>
{
const
interval
=
this
.
smartInterval
;
jasmine
.
clock
().
uninstall
();
setTimeout
(()
=>
{
});
const
intervalConfig
=
this
.
smartInterval
.
cfg
;
describe
(
'
Increment Interval
'
,
function
()
{
it
(
'
should increment the interval delay
'
,
(
done
)
=>
{
const
smartInterval
=
createDefaultSmartInterval
();
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
const
intervalConfig
=
smartInterval
.
cfg
;
const
iterationCount
=
4
;
const
iterationCount
=
4
;
const
maxIntervalAfterIterations
=
intervalConfig
.
startingInterval
*
const
maxIntervalAfterIterations
=
intervalConfig
.
startingInterval
*
(
intervalConfig
.
incrementByFactorOf
**
(
iterationCount
-
1
));
// 40
(
intervalConfig
.
incrementByFactorOf
**
iterationCount
);
const
currentInterval
=
i
nterval
.
getCurrentInterval
();
const
currentInterval
=
smartI
nterval
.
getCurrentInterval
();
// Provide some flexibility for performance of testing environment
// Provide some flexibility for performance of testing environment
expect
(
currentInterval
).
toBeGreaterThan
(
intervalConfig
.
startingInterval
);
expect
(
currentInterval
).
toBeGreaterThan
(
intervalConfig
.
startingInterval
);
expect
(
currentInterval
<=
maxIntervalAfterIterations
).
toBeTruthy
(
);
expect
(
currentInterval
).
toBeLessThanOrEqual
(
maxIntervalAfterIterations
);
})
done
();
.
then
(
done
)
},
DEFAULT_SHORT_TIMEOUT
);
// 4 iterations, increment by 2x = (5 + 10 + 20 + 40)
.
catch
(
done
.
fail
);
});
});
it
(
'
should not increment past maxInterval
'
,
function
(
done
)
{
it
(
'
should not increment past maxInterval
'
,
(
done
)
=>
{
const
interval
=
this
.
smartInterval
;
const
smartInterval
=
createDefaultSmartInterval
({
maxInterval
:
DEFAULT_STARTING_INTERVAL
})
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_STARTING_INTERVAL
);
const
currentInterval
=
interval
.
getCurrentInterval
();
jasmine
.
clock
().
tick
(
DEFAULT_STARTING_INTERVAL
*
DEFAULT_INCREMENT_FACTOR
);
expect
(
currentInterval
).
toBe
(
interval
.
cfg
.
maxInterval
);
done
();
waitForPromises
()
},
DEFAULT_LONG_TIMEOUT
);
.
then
(()
=>
{
const
currentInterval
=
smartInterval
.
getCurrentInterval
();
expect
(
currentInterval
).
toBe
(
smartInterval
.
cfg
.
maxInterval
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
does not increment while waiting for callback
'
,
function
()
{
it
(
'
does not increment while waiting for callback
'
,
done
=>
{
jasmine
.
clock
().
install
();
const
smartInterval
=
createDefaultSmartInterval
({
const
smartInterval
=
createDefaultSmartInterval
({
callback
:
()
=>
new
Promise
(
$
.
noop
),
callback
:
()
=>
new
Promise
(
$
.
noop
),
});
});
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
const
oneInterval
=
smartInterval
.
cfg
.
startingInterval
*
DEFAULT_INCREMENT_FACTOR
;
const
oneInterval
=
smartInterval
.
cfg
.
startingInterval
*
DEFAULT_INCREMENT_FACTOR
;
expect
(
smartInterval
.
getCurrentInterval
()).
toEqual
(
oneInterval
);
expect
(
smartInterval
.
getCurrentInterval
()).
toEqual
(
oneInterval
);
})
jasmine
.
clock
().
uninstall
();
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
});
...
@@ -84,34 +97,39 @@ describe('SmartInterval', function () {
...
@@ -84,34 +97,39 @@ describe('SmartInterval', function () {
it
(
'
should cancel an interval
'
,
function
(
done
)
{
it
(
'
should cancel an interval
'
,
function
(
done
)
{
const
interval
=
this
.
smartInterval
;
const
interval
=
this
.
smartInterval
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
interval
.
cancel
();
interval
.
cancel
();
waitForPromises
()
.
then
(()
=>
{
const
{
intervalId
}
=
interval
.
state
;
const
{
intervalId
}
=
interval
.
state
;
const
currentInterval
=
interval
.
getCurrentInterval
();
const
currentInterval
=
interval
.
getCurrentInterval
();
const
intervalLowerLimit
=
interval
.
cfg
.
startingInterval
;
const
intervalLowerLimit
=
interval
.
cfg
.
startingInterval
;
expect
(
intervalId
).
toBeUndefined
();
expect
(
intervalId
).
toBeUndefined
();
expect
(
currentInterval
).
toBe
(
intervalLowerLimit
);
expect
(
currentInterval
).
toBe
(
intervalLowerLimit
);
})
done
();
.
then
(
done
)
},
DEFAULT_SHORT_TIMEOUT
);
.
catch
(
done
.
fail
);
});
});
it
(
'
should resume an interval
'
,
function
(
done
)
{
it
(
'
should resume an interval
'
,
function
(
done
)
{
const
interval
=
this
.
smartInterval
;
const
interval
=
this
.
smartInterval
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
interval
.
cancel
();
interval
.
cancel
();
interval
.
resume
();
interval
.
resume
();
waitForPromises
()
.
then
(()
=>
{
const
{
intervalId
}
=
interval
.
state
;
const
{
intervalId
}
=
interval
.
state
;
expect
(
intervalId
).
toBeTruthy
();
expect
(
intervalId
).
toBeTruthy
();
})
done
();
.
then
(
done
)
},
DEFAULT_SHORT_TIMEOUT
);
.
catch
(
done
.
fail
);
});
});
});
});
...
@@ -126,22 +144,29 @@ describe('SmartInterval', function () {
...
@@ -126,22 +144,29 @@ describe('SmartInterval', function () {
it
(
'
should pause when page is not visible
'
,
function
(
done
)
{
it
(
'
should pause when page is not visible
'
,
function
(
done
)
{
const
interval
=
this
.
smartInterval
;
const
interval
=
this
.
smartInterval
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
// simulates triggering of visibilitychange event
// simulates triggering of visibilitychange event
interval
.
handleVisibilityChange
({
target
:
{
visibilityState
:
'
hidden
'
}
});
interval
.
handleVisibilityChange
({
target
:
{
visibilityState
:
'
hidden
'
}
});
expect
(
interval
.
state
.
intervalId
).
toBeUndefined
();
expect
(
interval
.
state
.
intervalId
).
toBeUndefined
();
done
();
})
},
DEFAULT_SHORT_TIMEOUT
);
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
should change to the hidden interval when page is not visible
'
,
function
(
done
)
{
it
(
'
should change to the hidden interval when page is not visible
'
,
done
=>
{
const
HIDDEN_INTERVAL
=
1500
;
const
HIDDEN_INTERVAL
=
1500
;
const
interval
=
createDefaultSmartInterval
({
hiddenInterval
:
HIDDEN_INTERVAL
});
const
interval
=
createDefaultSmartInterval
({
hiddenInterval
:
HIDDEN_INTERVAL
});
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
getCurrentInterval
()
>=
DEFAULT_STARTING_INTERVAL
&&
expect
(
interval
.
getCurrentInterval
()
>=
DEFAULT_STARTING_INTERVAL
&&
interval
.
getCurrentInterval
()
<=
DEFAULT_MAX_INTERVAL
).
toBeTruthy
();
interval
.
getCurrentInterval
()
<=
DEFAULT_MAX_INTERVAL
).
toBeTruthy
();
...
@@ -151,14 +176,18 @@ describe('SmartInterval', function () {
...
@@ -151,14 +176,18 @@ describe('SmartInterval', function () {
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
getCurrentInterval
()).
toBe
(
HIDDEN_INTERVAL
);
expect
(
interval
.
getCurrentInterval
()).
toBe
(
HIDDEN_INTERVAL
);
done
();
})
},
DEFAULT_SHORT_TIMEOUT
);
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
should resume when page is becomes visible at the previous interval
'
,
function
(
done
)
{
it
(
'
should resume when page is becomes visible at the previous interval
'
,
function
(
done
)
{
const
interval
=
this
.
smartInterval
;
const
interval
=
this
.
smartInterval
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
// simulates triggering of visibilitychange event
// simulates triggering of visibilitychange event
...
@@ -170,20 +199,24 @@ describe('SmartInterval', function () {
...
@@ -170,20 +199,24 @@ describe('SmartInterval', function () {
interval
.
handleVisibilityChange
({
target
:
{
visibilityState
:
'
visible
'
}
});
interval
.
handleVisibilityChange
({
target
:
{
visibilityState
:
'
visible
'
}
});
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
expect
(
interval
.
state
.
intervalId
).
toBeTruthy
();
})
done
();
.
then
(
done
)
},
DEFAULT_SHORT_TIMEOUT
);
.
catch
(
done
.
fail
);
});
});
it
(
'
should cancel on page unload
'
,
function
(
done
)
{
it
(
'
should cancel on page unload
'
,
function
(
done
)
{
const
interval
=
this
.
smartInterval
;
const
interval
=
this
.
smartInterval
;
setTimeout
(()
=>
{
jasmine
.
clock
().
tick
(
DEFAULT_SHORT_TIMEOUT
);
waitForPromises
()
.
then
(()
=>
{
$
(
document
).
triggerHandler
(
'
beforeunload
'
);
$
(
document
).
triggerHandler
(
'
beforeunload
'
);
expect
(
interval
.
state
.
intervalId
).
toBeUndefined
();
expect
(
interval
.
state
.
intervalId
).
toBeUndefined
();
expect
(
interval
.
getCurrentInterval
()).
toBe
(
interval
.
cfg
.
startingInterval
);
expect
(
interval
.
getCurrentInterval
()).
toBe
(
interval
.
cfg
.
startingInterval
);
done
();
})
},
DEFAULT_SHORT_TIMEOUT
);
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
should execute callback before first interval
'
,
function
()
{
it
(
'
should execute callback before first interval
'
,
function
()
{
...
...
spec/lib/gitlab/url_sanitizer_spec.rb
View file @
4f827d1e
...
@@ -92,6 +92,7 @@ describe Gitlab::UrlSanitizer do
...
@@ -92,6 +92,7 @@ describe Gitlab::UrlSanitizer do
context
'credentials in URL'
do
context
'credentials in URL'
do
where
(
:url
,
:credentials
)
do
where
(
:url
,
:credentials
)
do
'http://foo:bar@example.com'
|
{
user:
'foo'
,
password:
'bar'
}
'http://foo:bar@example.com'
|
{
user:
'foo'
,
password:
'bar'
}
'http://foo:bar:baz@example.com'
|
{
user:
'foo'
,
password:
'bar:baz'
}
'http://:bar@example.com'
|
{
user:
nil
,
password:
'bar'
}
'http://:bar@example.com'
|
{
user:
nil
,
password:
'bar'
}
'http://foo:@example.com'
|
{
user:
'foo'
,
password:
nil
}
'http://foo:@example.com'
|
{
user:
'foo'
,
password:
nil
}
'http://foo@example.com'
|
{
user:
'foo'
,
password:
nil
}
'http://foo@example.com'
|
{
user:
'foo'
,
password:
nil
}
...
...
spec/requests/api/runners_spec.rb
View file @
4f827d1e
...
@@ -211,6 +211,69 @@ describe API::Runners do
...
@@ -211,6 +211,69 @@ describe API::Runners do
describe
'PUT /runners/:id'
do
describe
'PUT /runners/:id'
do
context
'admin user'
do
context
'admin user'
do
# see https://gitlab.com/gitlab-org/gitlab-ce/issues/48625
context
'single parameter update'
do
it
'runner description'
do
description
=
shared_runner
.
description
update_runner
(
shared_runner
.
id
,
admin
,
description:
"
#{
description
}
_updated"
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
description
).
to
eq
(
"
#{
description
}
_updated"
)
end
it
'runner active state'
do
active
=
shared_runner
.
active
update_runner
(
shared_runner
.
id
,
admin
,
active:
!
active
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
active
).
to
eq
(
!
active
)
end
it
'runner tag list'
do
update_runner
(
shared_runner
.
id
,
admin
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
])
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
tag_list
).
to
include
(
'ruby2.1'
,
'pgsql'
,
'mysql'
)
end
it
'runner untagged flag'
do
# Ensure tag list is non-empty before setting untagged to false.
update_runner
(
shared_runner
.
id
,
admin
,
tag_list:
[
'ruby2.1'
,
'pgsql'
,
'mysql'
])
update_runner
(
shared_runner
.
id
,
admin
,
run_untagged:
'false'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
run_untagged?
).
to
be
(
false
)
end
it
'runner unlocked flag'
do
update_runner
(
shared_runner
.
id
,
admin
,
locked:
'true'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
locked?
).
to
be
(
true
)
end
it
'runner access level'
do
update_runner
(
shared_runner
.
id
,
admin
,
access_level:
'ref_protected'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
ref_protected?
).
to
be_truthy
end
it
'runner maximum timeout'
do
update_runner
(
shared_runner
.
id
,
admin
,
maximum_timeout:
1234
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
shared_runner
.
reload
.
maximum_timeout
).
to
eq
(
1234
)
end
it
'fails with no parameters'
do
put
api
(
"/runners/
#{
shared_runner
.
id
}
"
,
admin
)
shared_runner
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
end
context
'when runner is shared'
do
context
'when runner is shared'
do
it
'updates runner'
do
it
'updates runner'
do
description
=
shared_runner
.
description
description
=
shared_runner
.
description
...
...
spec/workers/git_garbage_collect_worker_spec.rb
View file @
4f827d1e
...
@@ -27,6 +27,12 @@ describe GitGarbageCollectWorker do
...
@@ -27,6 +27,12 @@ describe GitGarbageCollectWorker do
subject
.
perform
(
project
.
id
,
:gc
,
lease_key
,
lease_uuid
)
subject
.
perform
(
project
.
id
,
:gc
,
lease_key
,
lease_uuid
)
end
end
it
'handles gRPC errors'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
).
to
receive
(
:garbage_collect
).
and_raise
(
GRPC
::
NotFound
)
expect
{
subject
.
perform
(
project
.
id
,
:gc
,
lease_key
,
lease_uuid
)
}.
to
raise_exception
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
end
end
end
context
'with different lease than the active one'
do
context
'with different lease than the active one'
do
...
...
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