Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Thomas Gambier
slapos
Commits
818adb70
Commit
818adb70
authored
Nov 06, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/dufs: version up dufs 0.43.0
parent
51ca4092
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
16 deletions
+32
-16
software/dufs/buildout.hash.cfg
software/dufs/buildout.hash.cfg
+1
-1
software/dufs/instance.cfg.in
software/dufs/instance.cfg.in
+4
-3
software/dufs/software.cfg
software/dufs/software.cfg
+2
-2
software/dufs/test/setup.py
software/dufs/test/setup.py
+1
-0
software/dufs/test/test.py
software/dufs/test/test.py
+24
-10
No files found.
software/dufs/buildout.hash.cfg
View file @
818adb70
...
...
@@ -15,4 +15,4 @@
[instance.cfg.in]
filename = instance.cfg.in
md5sum =
1e9012cb8476e00497b3fe9881158440
md5sum =
c1c5db680dee5cfe5334cedae4b7fc51
software/dufs/instance.cfg.in
View file @
818adb70
...
...
@@ -189,9 +189,7 @@ return = domain secure_access
[frontend-available-promise]
<= check-url-available-promise
url = ${frontend:connection-secure_access}
check-secure = 1
url = ${frontend-url:healthcheck-url}
[promises]
recipe =
...
...
@@ -216,6 +214,9 @@ init =
assert not frontend_url.username
self.options['upload-url'] = frontend_url._replace(
netloc=f'{admin_user}:{admin_password}@{frontend_url.netloc}').geturl()
self.options['healthcheck-url'] = frontend_url._replace(
path='/__dufs__/health').geturl()
[publish-connection-parameter]
recipe = slapos.cookbook:publish
...
...
software/dufs/software.cfg
View file @
818adb70
...
...
@@ -13,8 +13,8 @@ parts =
[dufs]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/sigoden/dufs/archive/refs/tags/v0.4
0
.0.tar.gz
md5sum =
3b71b3d07af69d6ba92c054625dc0dd2
url = https://github.com/sigoden/dufs/archive/refs/tags/v0.4
3
.0.tar.gz
md5sum =
77da2d3e5b5f7f159707db5c93ce8a9d
configure-command = :
make-binary = cargo install --root=%(location)s --path . --locked
make-targets =
...
...
software/dufs/test/setup.py
View file @
818adb70
...
...
@@ -43,6 +43,7 @@ setup(
install_requires
=
[
'slapos.core'
,
'slapos.libnetworkcache'
,
'lxml'
,
'requests'
,
],
zip_safe
=
True
,
...
...
software/dufs/test/test.py
View file @
818adb70
...
...
@@ -25,7 +25,9 @@
#
##############################################################################
import
base64
import
contextlib
import
json
import
io
import
os
import
pathlib
...
...
@@ -33,13 +35,15 @@ import subprocess
import
tempfile
import
urllib.parse
import
requests
import
lxml.html
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
pathlib
.
Path
(
__file__
).
parent
.
parent
/
'software.cfg'
)
class
TestFileServer
(
SlapOSInstanceTestCase
):
...
...
@@ -63,6 +67,11 @@ class TestFileServer(SlapOSInstanceTestCase):
self
.
addCleanup
(
os
.
unlink
,
ca_cert
.
name
)
return
ca_cert
.
name
def
_decode_index_content
(
self
,
response_text
:
str
)
->
dict
:
index_data
,
=
lxml
.
html
.
fromstring
(
response_text
).
xpath
(
'.//template[@id="index-data"]/text()'
)
return
json
.
loads
(
base64
.
b64decode
(
index_data
))
def
test_anonymous_can_only_access_public
(
self
):
resp
=
requests
.
get
(
self
.
connection_parameters
[
'public-url'
],
...
...
@@ -87,12 +96,13 @@ class TestFileServer(SlapOSInstanceTestCase):
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'..'
),
verify
=
self
.
ca_cert
,
)
self
.
assertIn
(
'pub'
,
resp
.
text
)
self
.
assertNotIn
(
'secret'
,
resp
.
text
)
self
.
assertEqual
(
[
path
[
'name'
]
for
path
in
self
.
_decode_index_content
(
resp
.
text
)[
'paths'
]],
[
'pub'
])
self
.
assertEqual
(
resp
.
status_code
,
requests
.
codes
.
ok
)
def
test_index
(
self
):
pub
=
pathlib
.
Path
(
self
.
computer_partition_root_path
)
/
'srv'
/
'www'
/
'pub'
pub
=
self
.
computer_partition_root_path
/
'srv'
/
'www'
/
'pub'
(
pub
/
'with-index'
).
mkdir
()
(
pub
/
'with-index'
/
'index.html'
).
write_text
(
'<html>Hello !</html>'
)
self
.
assertEqual
(
...
...
@@ -106,10 +116,14 @@ class TestFileServer(SlapOSInstanceTestCase):
(
pub
/
'without-index'
/
'file.txt'
).
write_text
(
'Hello !'
)
self
.
assertIn
(
'file.txt'
,
requests
.
get
(
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'without-index/'
),
verify
=
self
.
ca_cert
,
).
text
)
[
path
[
'name'
]
for
path
in
self
.
_decode_index_content
(
requests
.
get
(
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'without-index/'
),
verify
=
self
.
ca_cert
,
).
text
)[
'paths'
]
]
)
def
test_upload_file_refused_without_auth
(
self
):
parsed_upload_url
=
urllib
.
parse
.
urlparse
(
self
.
connection_parameters
[
'upload-url'
])
...
...
@@ -168,7 +182,7 @@ class TestFileServer(SlapOSInstanceTestCase):
# reprocess instance to get the new certificate, after removing the timestamp
# to force execution
(
pathlib
.
Path
(
self
.
computer_partition_root_path
)
/
'.timestamp'
).
unlink
()
(
self
.
computer_partition_root_path
/
'.timestamp'
).
unlink
()
self
.
waitForInstance
()
cert_after
=
_getpeercert
()
...
...
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