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
df8c9ac3
Commit
df8c9ac3
authored
Mar 19, 2019
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix one EE spec for the new Gitlab::Shell interface to batch_add_keys
parent
22ef5a09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
ee/lib/gitlab/background_migration/update_authorized_keys_file_since.rb
...background_migration/update_authorized_keys_file_since.rb
+2
-4
ee/spec/lib/gitlab/background_migration/update_authorized_keys_file_since_spec.rb
...round_migration/update_authorized_keys_file_since_spec.rb
+9
-5
No files found.
ee/lib/gitlab/background_migration/update_authorized_keys_file_since.rb
View file @
df8c9ac3
...
...
@@ -32,10 +32,8 @@ module Gitlab
def
batch_add_keys_in_db_starting_from
(
start_id
)
Rails
.
logger
.
info
(
"Adding all keys starting from ID:
#{
start_id
}
"
)
gitlab_shell
.
batch_add_keys
do
|
adder
|
Key
.
find_each
(
start:
start_id
,
batch_size:
1000
)
do
|
key
|
adder
.
add_key
(
key
.
shell_id
,
key
.
key
)
end
::
Key
.
find_in_batches
(
start:
start_id
,
batch_size:
1000
)
do
|
keys
|
gitlab_shell
.
batch_add_keys
(
keys
)
end
end
end
...
...
ee/spec/lib/gitlab/background_migration/update_authorized_keys_file_since_spec.rb
View file @
df8c9ac3
...
...
@@ -80,15 +80,19 @@ describe Gitlab::BackgroundMigration::UpdateAuthorizedKeysFileSince do
background_migration
.
batch_add_keys_in_db_starting_from
(
@keys
[
3
].
id
)
file
=
File
.
read
(
Rails
.
root
.
join
(
'tmp/tests/.ssh/authorized_keys'
))
file
=
File
.
read
(
Rails
.
root
.
join
(
Gitlab
.
config
.
gitlab_shell
.
authorized_keys_file
))
expect
(
file
.
scan
(
/ssh-rsa/
).
count
).
to
eq
(
7
)
expect
(
file
).
not_to
include
(
Gitlab
::
Shell
.
strip_key
(
@keys
[
0
].
key
))
expect
(
file
).
not_to
include
(
Gitlab
::
Shell
.
strip_key
(
@keys
[
2
].
key
))
expect
(
file
).
to
include
(
Gitlab
::
Shell
.
strip_key
(
@keys
[
3
].
key
))
expect
(
file
).
to
include
(
Gitlab
::
Shell
.
strip_key
(
@keys
[
9
].
key
))
expect
(
file
).
not_to
include
(
strip_key
(
@keys
[
0
].
key
))
expect
(
file
).
not_to
include
(
strip_key
(
@keys
[
2
].
key
))
expect
(
file
).
to
include
(
strip_key
(
@keys
[
3
].
key
))
expect
(
file
).
to
include
(
strip_key
(
@keys
[
9
].
key
))
end
end
def
strip_key
(
key
)
key
.
split
(
/[ ]+/
)[
0
,
2
].
join
(
' '
)
end
end
end
# rubocop:enable RSpec/FactoriesInMigrationSpecs
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