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
a0032b72
Commit
a0032b72
authored
Oct 08, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump Gitaly client version for workhorse
parent
afc46c74
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
183 additions
and
106 deletions
+183
-106
workhorse/gitaly_integration_test.go
workhorse/gitaly_integration_test.go
+1
-1
workhorse/go.mod
workhorse/go.mod
+6
-6
workhorse/go.sum
workhorse/go.sum
+148
-72
workhorse/internal/artifacts/artifacts_store_test.go
workhorse/internal/artifacts/artifacts_store_test.go
+8
-8
workhorse/internal/artifacts/artifacts_upload_test.go
workhorse/internal/artifacts/artifacts_upload_test.go
+3
-3
workhorse/internal/filestore/save_file_opts_test.go
workhorse/internal/filestore/save_file_opts_test.go
+4
-4
workhorse/internal/git/archive.go
workhorse/internal/git/archive.go
+2
-2
workhorse/internal/gitaly/unmarshal_test.go
workhorse/internal/gitaly/unmarshal_test.go
+7
-6
workhorse/internal/upload/uploads_test.go
workhorse/internal/upload/uploads_test.go
+4
-4
No files found.
workhorse/gitaly_integration_test.go
View file @
a0032b72
...
...
@@ -230,7 +230,7 @@ func TestAllowedGetGitArchiveOldPayload(t *testing.T) {
// Create the repository in the Gitaly server
apiResponse
:=
realGitalyOkBody
(
t
)
repo
:=
apiResponse
.
Repository
repo
:=
&
apiResponse
.
Repository
require
.
NoError
(
t
,
ensureGitalyRepository
(
t
,
apiResponse
))
archivePath
:=
path
.
Join
(
scratchDir
,
"my/path"
)
...
...
workhorse/go.mod
View file @
a0032b72
...
...
@@ -3,11 +3,11 @@ module gitlab.com/gitlab-org/gitlab/workhorse
go 1.16
require (
github.com/Azure/azure-storage-blob-go v0.1
1.1-0.20201209121048-6df5d9af221d
github.com/Azure/azure-storage-blob-go v0.1
3.0
github.com/BurntSushi/toml v0.3.1
github.com/FZambia/sentinel v1.0.0
github.com/alecthomas/chroma v0.7.3
github.com/aws/aws-sdk-go v1.3
7.0
github.com/aws/aws-sdk-go v1.3
8.35
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 // indirect
github.com/disintegration/imaging v1.6.2
github.com/getsentry/raven-go v0.2.0
...
...
@@ -28,14 +28,14 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/smartystreets/goconvey v1.6.4
github.com/stretchr/testify v1.7.0
gitlab.com/gitlab-org/gitaly/v14 v14.
0.0-rc1
gitlab.com/gitlab-org/gitaly/v14 v14.
3.0-rc2.0.20211007055622-df7dadcc3f74
gitlab.com/gitlab-org/labkit v1.6.0
gocloud.dev v0.2
1.1-0.20201223184910-5094f54ed8bb
gocloud.dev v0.2
3.0
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5
golang.org/x/net v0.0.0-20210
316092652-d523dce5a7f4
golang.org/x/net v0.0.0-20210
505214959-0714010a04ed
golang.org/x/tools v0.1.0
google.golang.org/grpc v1.3
7
.0
google.golang.org/grpc v1.3
8
.0
gopkg.in/DataDog/dd-trace-go.v1 v1.31.0 // indirect
honnef.co/go/tools v0.1.3
)
workhorse/go.sum
View file @
a0032b72
This diff is collapsed.
Click to expand it.
workhorse/internal/artifacts/artifacts_store_test.go
View file @
a0032b72
...
...
@@ -102,11 +102,11 @@ func TestUploadHandlerSendingToExternalStorage(t *testing.T) {
tests
:=
[]
struct
{
name
string
preauth
api
.
Response
preauth
*
api
.
Response
}{
{
name
:
"ObjectStore Upload"
,
preauth
:
api
.
Response
{
preauth
:
&
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeServer
.
URL
+
"/url/put"
+
qs
,
ID
:
"store-id"
,
...
...
@@ -145,7 +145,7 @@ func TestUploadHandlerSendingToExternalStorageAndStorageServerUnreachable(t *tes
t
.
Fatal
(
"it should not be called"
)
}
authResponse
:=
api
.
Response
{
authResponse
:=
&
api
.
Response
{
TempPath
:
tempPath
,
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
"http://localhost:12323/invalid/url"
,
...
...
@@ -171,7 +171,7 @@ func TestUploadHandlerSendingToExternalStorageAndInvalidURLIsUsed(t *testing.T)
t
.
Fatal
(
"it should not be called"
)
}
authResponse
:=
api
.
Response
{
authResponse
:=
&
api
.
Response
{
TempPath
:
tempPath
,
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
"htt:////invalid-url"
,
...
...
@@ -203,7 +203,7 @@ func TestUploadHandlerSendingToExternalStorageAndItReturnsAnError(t *testing.T)
storeServer
:=
httptest
.
NewServer
(
storeServerMux
)
defer
storeServer
.
Close
()
authResponse
:=
api
.
Response
{
authResponse
:=
&
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeServer
.
URL
+
"/url/put"
,
ID
:
"store-id"
,
...
...
@@ -236,7 +236,7 @@ func TestUploadHandlerSendingToExternalStorageAndSupportRequestTimeout(t *testin
storeServer
:=
httptest
.
NewServer
(
storeServerMux
)
defer
storeServer
.
Close
()
authResponse
:=
api
.
Response
{
authResponse
:=
&
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeServer
.
URL
+
"/url/put"
,
ID
:
"store-id"
,
...
...
@@ -262,7 +262,7 @@ func TestUploadHandlerMultipartUploadSizeLimit(t *testing.T) {
objectURL
:=
server
.
URL
+
test
.
ObjectPath
uploadSize
:=
10
preauth
:=
api
.
Response
{
preauth
:=
&
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
ID
:
"store-id"
,
MultipartUpload
:
&
api
.
MultipartUploadParams
{
...
...
@@ -304,7 +304,7 @@ func TestUploadHandlerMultipartUploadMaximumSizeFromApi(t *testing.T) {
uploadSize
:=
int64
(
10
)
maxSize
:=
uploadSize
-
1
preauth
:=
api
.
Response
{
preauth
:=
&
api
.
Response
{
MaximumSize
:
maxSize
,
RemoteObject
:
api
.
RemoteObject
{
ID
:
"store-id"
,
...
...
workhorse/internal/artifacts/artifacts_upload_test.go
View file @
a0032b72
...
...
@@ -35,7 +35,7 @@ const (
Path
=
"/url/path"
)
func
testArtifactsUploadServer
(
t
*
testing
.
T
,
authResponse
api
.
Response
,
bodyProcessor
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
))
*
httptest
.
Server
{
func
testArtifactsUploadServer
(
t
*
testing
.
T
,
authResponse
*
api
.
Response
,
bodyProcessor
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
))
*
httptest
.
Server
{
mux
:=
http
.
NewServeMux
()
mux
.
HandleFunc
(
Path
+
"/authorize"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
if
r
.
Method
!=
"POST"
{
...
...
@@ -51,7 +51,7 @@ func testArtifactsUploadServer(t *testing.T, authResponse api.Response, bodyProc
w
.
Write
(
data
)
})
mux
.
HandleFunc
(
Path
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
opts
,
err
:=
filestore
.
GetOpts
(
&
authResponse
)
opts
,
err
:=
filestore
.
GetOpts
(
authResponse
)
require
.
NoError
(
t
,
err
)
if
r
.
Method
!=
"POST"
{
...
...
@@ -128,7 +128,7 @@ func setupWithTmpPath(t *testing.T, filename string, includeFormat bool, format
authResponse
=
&
api
.
Response
{
TempPath
:
tempPath
}
}
ts
:=
testArtifactsUploadServer
(
t
,
*
authResponse
,
bodyProcessor
)
ts
:=
testArtifactsUploadServer
(
t
,
authResponse
,
bodyProcessor
)
var
buffer
bytes
.
Buffer
writer
:=
multipart
.
NewWriter
(
&
buffer
)
...
...
workhorse/internal/filestore/save_file_opts_test.go
View file @
a0032b72
...
...
@@ -141,21 +141,21 @@ func TestGetOpts(t *testing.T) {
func
TestGetOptsFail
(
t
*
testing
.
T
)
{
testCases
:=
[]
struct
{
desc
string
in
api
.
Response
in
*
api
.
Response
}{
{
desc
:
"neither local nor remote"
,
in
:
api
.
Response
{},
in
:
&
api
.
Response
{},
},
{
desc
:
"both local and remote"
,
in
:
api
.
Response
{
TempPath
:
"/foobar"
,
RemoteObject
:
api
.
RemoteObject
{
ID
:
"id"
}},
in
:
&
api
.
Response
{
TempPath
:
"/foobar"
,
RemoteObject
:
api
.
RemoteObject
{
ID
:
"id"
}},
},
}
for
_
,
tc
:=
range
testCases
{
t
.
Run
(
tc
.
desc
,
func
(
t
*
testing
.
T
)
{
_
,
err
:=
filestore
.
GetOpts
(
&
tc
.
in
)
_
,
err
:=
filestore
.
GetOpts
(
tc
.
in
)
require
.
Error
(
t
,
err
,
"expect input to be rejected"
)
})
}
...
...
workhorse/internal/git/archive.go
View file @
a0032b72
...
...
@@ -102,7 +102,7 @@ func (a *archive) Inject(w http.ResponseWriter, r *http.Request, sendData string
var
archiveReader
io
.
Reader
archiveReader
,
err
=
handleArchiveWithGitaly
(
r
,
params
,
format
)
archiveReader
,
err
=
handleArchiveWithGitaly
(
r
,
&
params
,
format
)
if
err
!=
nil
{
helper
.
Fail500
(
w
,
r
,
fmt
.
Errorf
(
"operations.GetArchive: %v"
,
err
))
return
...
...
@@ -130,7 +130,7 @@ func (a *archive) Inject(w http.ResponseWriter, r *http.Request, sendData string
}
}
func
handleArchiveWithGitaly
(
r
*
http
.
Request
,
params
archiveParams
,
format
gitalypb
.
GetArchiveRequest_Format
)
(
io
.
Reader
,
error
)
{
func
handleArchiveWithGitaly
(
r
*
http
.
Request
,
params
*
archiveParams
,
format
gitalypb
.
GetArchiveRequest_Format
)
(
io
.
Reader
,
error
)
{
var
request
*
gitalypb
.
GetArchiveRequest
ctx
,
c
,
err
:=
gitaly
.
NewRepositoryClient
(
r
.
Context
(),
params
.
GitalyServer
)
if
err
!=
nil
{
...
...
workhorse/internal/gitaly/unmarshal_test.go
View file @
a0032b72
...
...
@@ -3,6 +3,7 @@ package gitaly
import
(
"testing"
"github.com/golang/protobuf/proto"
//lint:ignore SA1019 https://gitlab.com/gitlab-org/gitlab/-/issues/324868
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
)
...
...
@@ -11,25 +12,25 @@ func TestUnmarshalJSON(t *testing.T) {
testCases
:=
[]
struct
{
desc
string
in
string
out
gitalypb
.
Repository
out
*
gitalypb
.
Repository
}{
{
desc
:
"basic example"
,
in
:
`{"relative_path":"foo/bar.git"}`
,
out
:
gitalypb
.
Repository
{
RelativePath
:
"foo/bar.git"
},
out
:
&
gitalypb
.
Repository
{
RelativePath
:
"foo/bar.git"
},
},
{
desc
:
"unknown field"
,
in
:
`{"relative_path":"foo/bar.git","unknown_field":12345}`
,
out
:
gitalypb
.
Repository
{
RelativePath
:
"foo/bar.git"
},
out
:
&
gitalypb
.
Repository
{
RelativePath
:
"foo/bar.git"
},
},
}
for
_
,
tc
:=
range
testCases
{
t
.
Run
(
tc
.
desc
,
func
(
t
*
testing
.
T
)
{
result
:=
gitalypb
.
Repository
{}
require
.
NoError
(
t
,
UnmarshalJSON
(
tc
.
in
,
&
result
))
require
.
Equal
(
t
,
tc
.
out
,
result
)
result
:=
&
gitalypb
.
Repository
{}
require
.
NoError
(
t
,
UnmarshalJSON
(
tc
.
in
,
result
))
require
.
True
(
t
,
proto
.
Equal
(
tc
.
out
,
result
)
)
})
}
}
workhorse/internal/upload/uploads_test.go
View file @
a0032b72
...
...
@@ -271,19 +271,19 @@ func TestUploadProcessingFile(t *testing.T) {
tests
:=
[]
struct
{
name
string
preauth
api
.
Response
preauth
*
api
.
Response
}{
{
name
:
"FileStore Upload"
,
preauth
:
api
.
Response
{
TempPath
:
tempPath
},
preauth
:
&
api
.
Response
{
TempPath
:
tempPath
},
},
{
name
:
"ObjectStore Upload"
,
preauth
:
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeUrl
}},
preauth
:
&
api
.
Response
{
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeUrl
}},
},
{
name
:
"ObjectStore and FileStore Upload"
,
preauth
:
api
.
Response
{
preauth
:
&
api
.
Response
{
TempPath
:
tempPath
,
RemoteObject
:
api
.
RemoteObject
{
StoreURL
:
storeUrl
},
},
...
...
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