Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildgrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
BuildGrid
buildgrid
Commits
9d1bccd7
Commit
9d1bccd7
authored
6 years ago
by
Carter Sande
Browse files
Options
Downloads
Patches
Plain Diff
Fix CAS issues on Python 3.5
parent
49cc153a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Pipeline
#26618607
passed
6 years ago
Stage: test
Stage: post
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
buildgrid/server/cas/storage/disk.py
+3
-3
3 additions, 3 deletions
buildgrid/server/cas/storage/disk.py
tests/cas/test_services.py
+4
-4
4 additions, 4 deletions
tests/cas/test_services.py
with
7 additions
and
7 deletions
buildgrid/server/cas/storage/disk.py
+
3
−
3
View file @
9d1bccd7
...
...
@@ -32,14 +32,14 @@ class DiskStorage(StorageABC):
def
__init__
(
self
,
path
):
self
.
_path
=
pathlib
.
Path
(
path
)
os
.
makedirs
(
self
.
_path
/
"
temp
"
,
exist_ok
=
True
)
os
.
makedirs
(
str
(
self
.
_path
/
"
temp
"
)
,
exist_ok
=
True
)
def
has_blob
(
self
,
digest
):
return
(
self
.
_path
/
(
digest
.
hash
+
"
_
"
+
str
(
digest
.
size_bytes
))).
exists
()
def
get_blob
(
self
,
digest
):
try
:
return
open
(
self
.
_path
/
(
digest
.
hash
+
"
_
"
+
str
(
digest
.
size_bytes
))
,
'
rb
'
)
return
(
self
.
_path
/
(
digest
.
hash
+
"
_
"
+
str
(
digest
.
size_bytes
))
).
open
(
'
rb
'
)
except
FileNotFoundError
:
return
None
...
...
@@ -49,7 +49,7 @@ class DiskStorage(StorageABC):
def
commit_write
(
self
,
digest
,
write_session
):
# Atomically move the temporary file into place.
path
=
self
.
_path
/
(
digest
.
hash
+
"
_
"
+
str
(
digest
.
size_bytes
))
os
.
replace
(
write_session
.
name
,
path
)
os
.
replace
(
write_session
.
name
,
str
(
path
)
)
try
:
write_session
.
close
()
except
FileNotFoundError
:
...
...
This diff is collapsed.
Click to expand it.
tests/cas/test_services.py
+
4
−
4
View file @
9d1bccd7
...
...
@@ -83,7 +83,7 @@ def test_bytestream_read(data_to_read, instance):
request
=
bytestream_pb2
.
ReadRequest
()
if
instance
!=
""
:
request
.
resource_name
=
instance
+
"
/
"
request
.
resource_name
+=
f
"
blobs/
{
HASH
(
data_to_read
).
hexdigest
()
}
/
{
len
(
data_to_read
)
}
"
request
.
resource_name
+=
"
blobs/{
}/{}
"
.
format
(
HASH
(
data_to_read
).
hexdigest
()
,
len
(
data_to_read
)
)
data
=
b
""
for
response
in
servicer
.
Read
(
request
,
None
):
...
...
@@ -101,7 +101,7 @@ def test_bytestream_read_many(instance):
request
=
bytestream_pb2
.
ReadRequest
()
if
instance
!=
""
:
request
.
resource_name
=
instance
+
"
/
"
request
.
resource_name
+=
f
"
blobs/
{
HASH
(
data_to_read
).
hexdigest
()
}
/
{
len
(
data_to_read
)
}
"
request
.
resource_name
+=
"
blobs/{
}/{}
"
.
format
(
HASH
(
data_to_read
).
hexdigest
()
,
len
(
data_to_read
)
)
data
=
b
""
for
response
in
servicer
.
Read
(
request
,
None
):
...
...
@@ -119,7 +119,7 @@ def test_bytestream_write(instance, extra_data):
if
instance
!=
""
:
resource_name
=
instance
+
"
/
"
hash_
=
HASH
(
b
'
abcdef
'
).
hexdigest
()
resource_name
+=
f
"
uploads/UUID-HERE/blobs/
{
hash_
}
/6
"
resource_name
+=
"
uploads/UUID-HERE/blobs/{
}/6
"
.
format
(
hash_
)
resource_name
+=
extra_data
requests
=
[
bytestream_pb2
.
WriteRequest
(
resource_name
=
resource_name
,
data
=
b
'
abc
'
),
...
...
@@ -139,7 +139,7 @@ def test_bytestream_write_rejects_wrong_hash():
data
=
b
'
some data
'
wrong_hash
=
HASH
(
b
'
incorrect
'
).
hexdigest
()
resource_name
=
f
"
uploads/UUID-HERE/blobs/
{
wrong_hash
}
/9
"
resource_name
=
"
uploads/UUID-HERE/blobs/{
}/9
"
.
format
(
wrong_hash
)
requests
=
[
bytestream_pb2
.
WriteRequest
(
resource_name
=
resource_name
,
data
=
data
,
finish_write
=
True
)
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment