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
b02565d2
Commit
b02565d2
authored
Dec 24, 2019
by
Hayley Swimelar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use multipart uploads for nuget packages
parent
9a9a83e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
internal/upstream/routes.go
internal/upstream/routes.go
+1
-1
upload_test.go
upload_test.go
+17
-9
No files found.
internal/upstream/routes.go
View file @
b02565d2
...
...
@@ -208,7 +208,7 @@ func (u *upstream) configureRoutes() {
route
(
"PUT"
,
apiPattern
+
`v4/packages/conan/`
,
filestore
.
BodyUploader
(
api
,
proxy
,
nil
)),
// NuGet Artifact Repository
route
(
"PUT"
,
apiPattern
+
`v4/projects/[0-9]+/packages/nuget/`
,
filestore
.
BodyUploader
(
api
,
proxy
,
nil
)),
route
(
"PUT"
,
apiPattern
+
`v4/projects/[0-9]+/packages/nuget/`
,
upload
.
Accelerate
(
api
,
proxy
)),
// We are porting API to disk acceleration
// we need to declare each routes until we have fixed all the routes on the rails codebase.
...
...
upload_test.go
View file @
b02565d2
...
...
@@ -117,18 +117,27 @@ func TestAcceleratedUpload(t *testing.T) {
ws
:=
startWorkhorseServer
(
ts
.
URL
)
defer
ws
.
Close
()
resources
:=
[]
string
{
`/example`
,
`/uploads/personal_snippet`
,
`/uploads/user`
,
`/api/v4/projects/1/wikis/attachments`
,
`/api/graphql`
,
tests
:=
[]
struct
{
method
string
resource
string
}{
{
"POST"
,
`/example`
},
{
"POST"
,
`/uploads/personal_snippet`
},
{
"POST"
,
`/uploads/user`
},
{
"POST"
,
`/api/v4/projects/1/wikis/attachments`
},
{
"POST"
,
`/api/graphql`
},
{
"PUT"
,
"/api/v4/projects/9001/packages/nuget/v1/files"
},
}
for
_
,
resource
:=
range
resources
{
for
_
,
tt
:=
range
tests
{
reqBody
,
contentType
,
err
:=
multipartBodyWithFile
()
require
.
NoError
(
t
,
err
)
resp
,
err
:=
http
.
Post
(
ws
.
URL
+
resource
,
contentType
,
reqBody
)
req
,
err
:=
http
.
NewRequest
(
tt
.
method
,
ws
.
URL
+
tt
.
resource
,
reqBody
)
require
.
NoError
(
t
,
err
)
req
.
Header
.
Set
(
"Content-Type"
,
contentType
)
resp
,
err
:=
http
.
DefaultClient
.
Do
(
req
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
200
,
resp
.
StatusCode
)
...
...
@@ -330,7 +339,6 @@ func testPackageFileUpload(t *testing.T, resource string) {
func
TestPackageFilesUpload
(
t
*
testing
.
T
)
{
routes
:=
[]
string
{
"/api/v4/packages/conan/v1/files"
,
"/api/v4/projects/9001/packages/nuget/v1/files"
,
"/api/v4/projects/2412/packages/maven/v1/files"
,
}
...
...
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