Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
0
Merge Requests
0
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-shell
Commits
aa82832f
Commit
aa82832f
authored
Oct 18, 2019
by
Ash McKenzie
Committed by
Igor Drozdov
Oct 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More consistent console messages (Ruby)
parent
1bade9e1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
spec/gitlab_shell_custom_git_receive_pack_spec.rb
spec/gitlab_shell_custom_git_receive_pack_spec.rb
+18
-8
spec/gitlab_shell_lfs_authentication_spec.rb
spec/gitlab_shell_lfs_authentication_spec.rb
+2
-1
No files found.
spec/gitlab_shell_custom_git_receive_pack_spec.rb
View file @
aa82832f
...
...
@@ -8,6 +8,7 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
include_context
'gitlab shell'
let
(
:env
)
{
{
'SSH_CONNECTION'
=>
'fake'
,
'SSH_ORIGINAL_COMMAND'
=>
'git-receive-pack group/repo'
}
}
let
(
:divider
)
{
"remote: ========================================================================
\n
"
}
before
(
:context
)
do
write_config
(
"gitlab_url"
=>
"http+unix://
#{
CGI
.
escape
(
tmp_socket_path
)
}
"
)
...
...
@@ -65,21 +66,24 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
end
describe
'dialog for performing a custom action'
do
let
(
:inaccessible_error
)
{
"Internal API error (403)
\n
"
}
context
'when API calls perform successfully'
do
let
(
:remote_blank_line
)
{
"remote:
\n
"
}
def
verify_successful_call!
(
cmd
)
Open3
.
popen3
(
env
,
cmd
)
do
|
stdin
,
stdout
,
stderr
|
expect
(
stderr
.
gets
).
to
eq
(
"> GitLab: console
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
"> GitLab: message
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
remote_blank_line
)
expect
(
stderr
.
gets
).
to
eq
(
"remote: console
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
"remote: message
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
remote_blank_line
)
expect
(
stderr
.
gets
).
to
eq
(
"> GitLab: info_message
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
"> GitLab: another_message
\n
"
)
expect
(
stdout
.
gets
(
6
)).
to
eq
(
"custom"
)
expect
(
stderr
.
gets
).
to
eq
(
remote_blank_line
)
expect
(
stderr
.
gets
).
to
eq
(
"remote: info_message
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
"remote: another_message
\n
"
)
expect
(
stderr
.
gets
).
to
eq
(
remote_blank_line
)
stdin
.
puts
(
"input"
)
stdin
.
close
expect
(
stdout
.
gets
(
6
)).
to
eq
(
"custom"
)
expect
(
stdout
.
flush
.
read
).
to
eq
(
"input
\n
"
)
end
end
...
...
@@ -106,7 +110,13 @@ describe 'Custom bin/gitlab-shell git-receive-pack' do
it
'custom action is not performed'
do
Open3
.
popen2e
(
env
,
cmd
)
do
|
stdin
,
stdout
|
expect
(
stdout
.
gets
).
to
eq
(
inaccessible_error
)
expect
(
stdout
.
gets
).
to
eq
(
"remote:
\n
"
)
expect
(
stdout
.
gets
).
to
eq
(
divider
)
expect
(
stdout
.
gets
).
to
eq
(
"remote:
\n
"
)
expect
(
stdout
.
gets
).
to
eq
(
"remote: Internal API error (403)
\n
"
)
expect
(
stdout
.
gets
).
to
eq
(
"remote:
\n
"
)
expect
(
stdout
.
gets
).
to
eq
(
divider
)
expect
(
stdout
.
gets
).
to
eq
(
"remote:
\n
"
)
end
end
end
...
...
spec/gitlab_shell_lfs_authentication_spec.rb
View file @
aa82832f
...
...
@@ -117,9 +117,10 @@ describe 'bin/gitlab-shell git-lfs-authentication' do
let
(
:env
)
{
{
'SSH_CONNECTION'
=>
'fake'
,
'SSH_ORIGINAL_COMMAND'
=>
'git-lfs-authenticate project/repo unknown'
}
}
it
'the command is disallowed'
do
divider
=
"remote:
\n
remote: ========================================================================
\n
remote:
\n
"
_
,
stderr
,
status
=
Open3
.
capture3
(
env
,
cmd
)
expect
(
stderr
).
to
eq
(
"
> GitLab: Disallowed command
\n
"
)
expect
(
stderr
).
to
eq
(
"
#{
divider
}
remote: Disallowed command
\n
#{
divider
}
"
)
expect
(
status
).
not_to
be_success
end
end
...
...
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