summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-02-16 07:04:15 -0800
committerStan Hu <stanhu@gmail.com>2019-02-16 07:39:14 -0800
commitebedab837012f844a47645f86412d3ec69aa2b4b (patch)
treeb27923bdc960d088901a97263ba75e868dbec0fb /spec
parent015ff88ade79910d5c3dd7505b89a0659f2d6b24 (diff)
downloadgitlab-shell-ebedab837012f844a47645f86412d3ec69aa2b4b.tar.gz
Add support for using gl_project_pathsh-use-gl-project-path
This will enable us to track the human-readable project path with SSH access in gitlab-shell. Currently the Gitaly logs will only show the hashed storage and gl_repository path (e.g. project-1234).
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_access_spec.rb2
-rw-r--r--spec/gitlab_net_spec.rb4
-rw-r--r--spec/gitlab_shell_spec.rb5
-rw-r--r--spec/vcr_cassettes/allowed-pull.yml2
-rw-r--r--spec/vcr_cassettes/allowed-push.yml2
5 files changed, 13 insertions, 2 deletions
diff --git a/spec/gitlab_access_spec.rb b/spec/gitlab_access_spec.rb
index 92268e2..6c1d348 100644
--- a/spec/gitlab_access_spec.rb
+++ b/spec/gitlab_access_spec.rb
@@ -11,6 +11,7 @@ describe GitlabAccess do
'200',
'ok',
gl_repository: 'project-1',
+ gl_project_path: 'group/subgroup/project',
gl_id: 'user-123',
gl_username: 'testuser',
git_config_options: ['receive.MaxInputSize=10000'],
@@ -49,6 +50,7 @@ describe GitlabAccess do
'401',
'denied',
gl_repository: nil,
+ gl_project_path: nil,
gl_id: nil,
gl_username: nil,
git_config_options: nil,
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index c6245d4..d7c46dc 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -287,7 +287,9 @@ describe GitlabNet, vcr: true do
it 'should allow push access for host' do
VCR.use_cassette("allowed-push") do
access = gitlab_net.check_access('git-receive-pack', nil, project, key, changes, 'ssh')
+
expect(access.allowed?).to be_truthy
+ expect(access.gl_project_path).to eq('gitlab-org/gitlab.test')
end
end
@@ -322,7 +324,9 @@ describe GitlabNet, vcr: true do
it 'should allow pull access for host' do
VCR.use_cassette("allowed-pull") do
access = gitlab_net.check_access('git-upload-pack', nil, project, key, changes, 'ssh')
+
expect(access.allowed?).to be_truthy
+ expect(access.gl_project_path).to eq('gitlab-org/gitlab.test')
end
end
end
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb
index eef572e..c261e6f 100644
--- a/spec/gitlab_shell_spec.rb
+++ b/spec/gitlab_shell_spec.rb
@@ -28,6 +28,7 @@ describe GitlabShell do
'200',
'ok',
gl_repository: gl_repository,
+ gl_project_path: gl_project_path,
gl_id: gl_id,
gl_username: gl_username,
git_config_options: git_config_options,
@@ -44,6 +45,7 @@ describe GitlabShell do
'200',
'ok',
gl_repository: gl_repository,
+ gl_project_path: gl_project_path,
gl_id: gl_id,
gl_username: gl_username,
git_config_options: nil,
@@ -62,6 +64,7 @@ describe GitlabShell do
let(:repo_name) { 'gitlab-ci.git' }
let(:gl_repository) { 'project-1' }
+ let(:gl_project_path) { 'group/subgroup/gitlab-ci' }
let(:gl_id) { 'user-1' }
let(:gl_username) { 'testuser' }
let(:git_config_options) { ['receive.MaxInputSize=10000'] }
@@ -169,6 +172,7 @@ describe GitlabShell do
JSON.dump(
'repository' => { 'relative_path' => repo_name, 'storage_name' => 'default' },
'gl_repository' => gl_repository,
+ 'gl_project_path' => gl_project_path,
'gl_id' => gl_id,
'gl_username' => gl_username,
'git_config_options' => git_config_options,
@@ -446,6 +450,7 @@ describe GitlabShell do
false,
'denied',
gl_repository: nil,
+ gl_project_path: nil,
gl_id: nil,
gl_username: nil,
git_config_options: nil,
diff --git a/spec/vcr_cassettes/allowed-pull.yml b/spec/vcr_cassettes/allowed-pull.yml
index b073476..d324316 100644
--- a/spec/vcr_cassettes/allowed-pull.yml
+++ b/spec/vcr_cassettes/allowed-pull.yml
@@ -40,7 +40,7 @@ http_interactions:
- '0.230871'
body:
encoding: UTF-8
- string: '{"status":true,"gl_repository":"project-3","repository_path":"/Users/dzaporozhets/Projects/gitlab-development-kit/repositories/gitlab-org/gitlab-test.git"}'
+ string: '{"status":true,"gl_repository":"project-3","gl_project_path":"gitlab-org/gitlab.test","repository_path":"/Users/dzaporozhets/Projects/gitlab-development-kit/repositories/gitlab-org/gitlab-test.git"}'
http_version:
recorded_at: Wed, 21 Jun 2017 10:44:52 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/allowed-push.yml b/spec/vcr_cassettes/allowed-push.yml
index 1636fd5..025614a 100644
--- a/spec/vcr_cassettes/allowed-push.yml
+++ b/spec/vcr_cassettes/allowed-push.yml
@@ -40,7 +40,7 @@ http_interactions:
- '0.289759'
body:
encoding: UTF-8
- string: '{"status":true,"gl_repository":"project-3","repository_path":"/Users/dzaporozhets/Projects/gitlab-development-kit/repositories/gitlab-org/gitlab-test.git"}'
+ string: '{"status":true,"gl_repository":"project-3","gl_project_path":"gitlab-org/gitlab.test","repository_path":"/Users/dzaporozhets/Projects/gitlab-development-kit/repositories/gitlab-org/gitlab-test.git"}'
http_version:
recorded_at: Wed, 21 Jun 2017 10:44:52 GMT
recorded_with: VCR 2.4.0