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
e8bad184
Commit
e8bad184
authored
Oct 24, 2019
by
gfyoung
Committed by
Thong Kuah
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable frozen string for spec/models
Partially addresses:
https://gitlab.com/gitlab-org/gitlab/issues/27703
parent
0805006e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
25 deletions
+34
-25
spec/migrations/schedule_fix_gitlab_com_pages_access_level_spec.rb
...ations/schedule_fix_gitlab_com_pages_access_level_spec.rb
+2
-0
spec/models/ci/build_trace_chunk_spec.rb
spec/models/ci/build_trace_chunk_spec.rb
+26
-24
spec/models/shard_spec.rb
spec/models/shard_spec.rb
+2
-1
spec/sidekiq/cron/job_gem_dependency_spec.rb
spec/sidekiq/cron/job_gem_dependency_spec.rb
+2
-0
spec/support/helpers/smime_helper.rb
spec/support/helpers/smime_helper.rb
+2
-0
No files found.
spec/migrations/schedule_fix_gitlab_com_pages_access_level_spec.rb
View file @
e8bad184
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191017045817_schedule_fix_gitlab_com_pages_access_level.rb'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20191017045817_schedule_fix_gitlab_com_pages_access_level.rb'
)
...
...
spec/models/ci/build_trace_chunk_spec.rb
View file @
e8bad184
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
BuildTraceChunk
,
:clean_gitlab_redis_shared_state
do
describe
Ci
::
BuildTraceChunk
,
:clean_gitlab_redis_shared_state
do
...
@@ -63,7 +65,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -63,7 +65,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:redis
}
let
(
:data_store
)
{
:redis
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
'Sample data in redis'
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
+
'Sample data in redis'
)
end
end
it
{
is_expected
.
to
eq
(
'Sample data in redis'
)
}
it
{
is_expected
.
to
eq
(
'Sample data in redis'
)
}
...
@@ -71,7 +73,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -71,7 +73,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context
'when data_store is database'
do
context
'when data_store is database'
do
let
(
:data_store
)
{
:database
}
let
(
:data_store
)
{
:database
}
let
(
:raw_data
)
{
'Sample data in database'
}
let
(
:raw_data
)
{
+
'Sample data in database'
}
it
{
is_expected
.
to
eq
(
'Sample data in database'
)
}
it
{
is_expected
.
to
eq
(
'Sample data in database'
)
}
end
end
...
@@ -80,7 +82,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -80,7 +82,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:fog
}
let
(
:data_store
)
{
:fog
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
'Sample data in fog'
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
+
'Sample data in fog'
)
end
end
it
{
is_expected
.
to
eq
(
'Sample data in fog'
)
}
it
{
is_expected
.
to
eq
(
'Sample data in fog'
)
}
...
@@ -90,7 +92,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -90,7 +92,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
describe
'#append'
do
describe
'#append'
do
subject
{
build_trace_chunk
.
append
(
new_data
,
offset
)
}
subject
{
build_trace_chunk
.
append
(
new_data
,
offset
)
}
let
(
:new_data
)
{
'Sample new data'
}
let
(
:new_data
)
{
+
'Sample new data'
}
let
(
:offset
)
{
0
}
let
(
:offset
)
{
0
}
let
(
:merged_data
)
{
data
+
new_data
.
to_s
}
let
(
:merged_data
)
{
data
+
new_data
.
to_s
}
...
@@ -143,7 +145,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -143,7 +145,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when new_data is empty'
do
context
'when new_data is empty'
do
let
(
:new_data
)
{
''
}
let
(
:new_data
)
{
+
''
}
it
'does not append'
do
it
'does not append'
do
subject
subject
...
@@ -172,7 +174,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -172,7 +174,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
shared_examples_for
'Scheduling sidekiq worker to flush data to persist store'
do
shared_examples_for
'Scheduling sidekiq worker to flush data to persist store'
do
context
'when new data fulfilled chunk size'
do
context
'when new data fulfilled chunk size'
do
let
(
:new_data
)
{
'a'
*
described_class
::
CHUNK_SIZE
}
let
(
:new_data
)
{
+
'a'
*
described_class
::
CHUNK_SIZE
}
it
'schedules trace chunk flush worker'
do
it
'schedules trace chunk flush worker'
do
expect
(
Ci
::
BuildTraceChunkFlushWorker
).
to
receive
(
:perform_async
).
once
expect
(
Ci
::
BuildTraceChunkFlushWorker
).
to
receive
(
:perform_async
).
once
...
@@ -194,7 +196,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -194,7 +196,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
shared_examples_for
'Scheduling no sidekiq worker'
do
shared_examples_for
'Scheduling no sidekiq worker'
do
context
'when new data fulfilled chunk size'
do
context
'when new data fulfilled chunk size'
do
let
(
:new_data
)
{
'a'
*
described_class
::
CHUNK_SIZE
}
let
(
:new_data
)
{
+
'a'
*
described_class
::
CHUNK_SIZE
}
it
'does not schedule trace chunk flush worker'
do
it
'does not schedule trace chunk flush worker'
do
expect
(
Ci
::
BuildTraceChunkFlushWorker
).
not_to
receive
(
:perform_async
)
expect
(
Ci
::
BuildTraceChunkFlushWorker
).
not_to
receive
(
:perform_async
)
...
@@ -219,7 +221,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -219,7 +221,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:redis
}
let
(
:data_store
)
{
:redis
}
context
'when there are no data'
do
context
'when there are no data'
do
let
(
:data
)
{
''
}
let
(
:data
)
{
+
''
}
it
'has no data'
do
it
'has no data'
do
expect
(
build_trace_chunk
.
data
).
to
be_empty
expect
(
build_trace_chunk
.
data
).
to
be_empty
...
@@ -230,7 +232,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -230,7 +232,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when there are some data'
do
context
'when there are some data'
do
let
(
:data
)
{
'Sample data in redis'
}
let
(
:data
)
{
+
'Sample data in redis'
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
...
@@ -249,7 +251,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -249,7 +251,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:database
}
let
(
:data_store
)
{
:database
}
context
'when there are no data'
do
context
'when there are no data'
do
let
(
:data
)
{
''
}
let
(
:data
)
{
+
''
}
it
'has no data'
do
it
'has no data'
do
expect
(
build_trace_chunk
.
data
).
to
be_empty
expect
(
build_trace_chunk
.
data
).
to
be_empty
...
@@ -260,7 +262,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -260,7 +262,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when there are some data'
do
context
'when there are some data'
do
let
(
:raw_data
)
{
'Sample data in database'
}
let
(
:raw_data
)
{
+
'Sample data in database'
}
let
(
:data
)
{
raw_data
}
let
(
:data
)
{
raw_data
}
it
'has data'
do
it
'has data'
do
...
@@ -276,7 +278,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -276,7 +278,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:fog
}
let
(
:data_store
)
{
:fog
}
context
'when there are no data'
do
context
'when there are no data'
do
let
(
:data
)
{
''
}
let
(
:data
)
{
+
''
}
it
'has no data'
do
it
'has no data'
do
expect
(
build_trace_chunk
.
data
).
to
be_empty
expect
(
build_trace_chunk
.
data
).
to
be_empty
...
@@ -287,7 +289,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -287,7 +289,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when there are some data'
do
context
'when there are some data'
do
let
(
:data
)
{
'Sample data in fog'
}
let
(
:data
)
{
+
'Sample data in fog'
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
...
@@ -332,7 +334,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -332,7 +334,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context
'when data_store is redis'
do
context
'when data_store is redis'
do
let
(
:data_store
)
{
:redis
}
let
(
:data_store
)
{
:redis
}
let
(
:data
)
{
'Sample data in redis'
}
let
(
:data
)
{
+
'Sample data in redis'
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
...
@@ -343,7 +345,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -343,7 +345,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context
'when data_store is database'
do
context
'when data_store is database'
do
let
(
:data_store
)
{
:database
}
let
(
:data_store
)
{
:database
}
let
(
:raw_data
)
{
'Sample data in database'
}
let
(
:raw_data
)
{
+
'Sample data in database'
}
let
(
:data
)
{
raw_data
}
let
(
:data
)
{
raw_data
}
it_behaves_like
'truncates'
it_behaves_like
'truncates'
...
@@ -351,7 +353,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -351,7 +353,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
context
'when data_store is fog'
do
context
'when data_store is fog'
do
let
(
:data_store
)
{
:fog
}
let
(
:data_store
)
{
:fog
}
let
(
:data
)
{
'Sample data in fog'
}
let
(
:data
)
{
+
'Sample data in fog'
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
...
@@ -368,7 +370,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -368,7 +370,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:redis
}
let
(
:data_store
)
{
:redis
}
context
'when data exists'
do
context
'when data exists'
do
let
(
:data
)
{
'Sample data in redis'
}
let
(
:data
)
{
+
'Sample data in redis'
}
before
do
before
do
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
build_trace_chunk
.
send
(
:unsafe_set_data!
,
data
)
...
@@ -386,7 +388,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -386,7 +388,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:database
}
let
(
:data_store
)
{
:database
}
context
'when data exists'
do
context
'when data exists'
do
let
(
:raw_data
)
{
'Sample data in database'
}
let
(
:raw_data
)
{
+
'Sample data in database'
}
let
(
:data
)
{
raw_data
}
let
(
:data
)
{
raw_data
}
it
{
is_expected
.
to
eq
(
data
.
bytesize
)
}
it
{
is_expected
.
to
eq
(
data
.
bytesize
)
}
...
@@ -401,7 +403,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -401,7 +403,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
let
(
:data_store
)
{
:fog
}
let
(
:data_store
)
{
:fog
}
context
'when data exists'
do
context
'when data exists'
do
let
(
:data
)
{
'Sample data in fog'
}
let
(
:data
)
{
+
'Sample data in fog'
}
let
(
:key
)
{
"tmp/builds/
#{
build
.
id
}
/chunks/
#{
chunk_index
}
.log"
}
let
(
:key
)
{
"tmp/builds/
#{
build
.
id
}
/chunks/
#{
chunk_index
}
.log"
}
before
do
before
do
...
@@ -443,7 +445,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -443,7 +445,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when data size reached CHUNK_SIZE'
do
context
'when data size reached CHUNK_SIZE'
do
let
(
:data
)
{
'a'
*
described_class
::
CHUNK_SIZE
}
let
(
:data
)
{
+
'a'
*
described_class
::
CHUNK_SIZE
}
it
'persists the data'
do
it
'persists the data'
do
expect
(
build_trace_chunk
.
redis?
).
to
be_truthy
expect
(
build_trace_chunk
.
redis?
).
to
be_truthy
...
@@ -463,7 +465,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -463,7 +465,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when data size has not reached CHUNK_SIZE'
do
context
'when data size has not reached CHUNK_SIZE'
do
let
(
:data
)
{
'Sample data in redis'
}
let
(
:data
)
{
+
'Sample data in redis'
}
it
'does not persist the data and the orignal data is intact'
do
it
'does not persist the data and the orignal data is intact'
do
expect
{
subject
}.
to
raise_error
(
described_class
::
FailedToPersistDataError
)
expect
{
subject
}.
to
raise_error
(
described_class
::
FailedToPersistDataError
)
...
@@ -492,7 +494,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -492,7 +494,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when data size reached CHUNK_SIZE'
do
context
'when data size reached CHUNK_SIZE'
do
let
(
:data
)
{
'a'
*
described_class
::
CHUNK_SIZE
}
let
(
:data
)
{
+
'a'
*
described_class
::
CHUNK_SIZE
}
it
'persists the data'
do
it
'persists the data'
do
expect
(
build_trace_chunk
.
database?
).
to
be_truthy
expect
(
build_trace_chunk
.
database?
).
to
be_truthy
...
@@ -512,7 +514,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -512,7 +514,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when data size has not reached CHUNK_SIZE'
do
context
'when data size has not reached CHUNK_SIZE'
do
let
(
:data
)
{
'Sample data in database'
}
let
(
:data
)
{
+
'Sample data in database'
}
it
'does not persist the data and the orignal data is intact'
do
it
'does not persist the data and the orignal data is intact'
do
expect
{
subject
}.
to
raise_error
(
described_class
::
FailedToPersistDataError
)
expect
{
subject
}.
to
raise_error
(
described_class
::
FailedToPersistDataError
)
...
@@ -561,7 +563,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -561,7 +563,7 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
context
'when data size has not reached CHUNK_SIZE'
do
context
'when data size has not reached CHUNK_SIZE'
do
let
(
:data
)
{
'Sample data in fog'
}
let
(
:data
)
{
+
'Sample data in fog'
}
it
'does not raise error'
do
it
'does not raise error'
do
expect
{
subject
}.
not_to
raise_error
expect
{
subject
}.
not_to
raise_error
...
...
spec/models/shard_spec.rb
View file @
e8bad184
# frozen_string_literals: true
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
describe
Shard
do
describe
Shard
do
...
...
spec/sidekiq/cron/job_gem_dependency_spec.rb
View file @
e8bad184
# frozen_string_literal: true
require
'spec_helper'
require
'spec_helper'
describe
Sidekiq
::
Cron
::
Job
do
describe
Sidekiq
::
Cron
::
Job
do
...
...
spec/support/helpers/smime_helper.rb
View file @
e8bad184
# frozen_string_literal: true
module
SmimeHelper
module
SmimeHelper
include
OpenSSL
include
OpenSSL
...
...
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