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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
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 @@
...
@@ -15,4 +15,4 @@
[instance.cfg.in]
[instance.cfg.in]
filename = 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
...
@@ -189,9 +189,7 @@ return = domain secure_access
[frontend-available-promise]
[frontend-available-promise]
<= check-url-available-promise
<= check-url-available-promise
url = ${frontend:connection-secure_access}
url = ${frontend-url:healthcheck-url}
check-secure = 1
[promises]
[promises]
recipe =
recipe =
...
@@ -216,6 +214,9 @@ init =
...
@@ -216,6 +214,9 @@ init =
assert not frontend_url.username
assert not frontend_url.username
self.options['upload-url'] = frontend_url._replace(
self.options['upload-url'] = frontend_url._replace(
netloc=f'{admin_user}:{admin_password}@{frontend_url.netloc}').geturl()
netloc=f'{admin_user}:{admin_password}@{frontend_url.netloc}').geturl()
self.options['healthcheck-url'] = frontend_url._replace(
path='/__dufs__/health').geturl()
[publish-connection-parameter]
[publish-connection-parameter]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
...
...
software/dufs/software.cfg
View file @
818adb70
...
@@ -13,8 +13,8 @@ parts =
...
@@ -13,8 +13,8 @@ parts =
[dufs]
[dufs]
recipe = slapos.recipe.cmmi
recipe = slapos.recipe.cmmi
shared = true
shared = true
url = https://github.com/sigoden/dufs/archive/refs/tags/v0.4
0
.0.tar.gz
url = https://github.com/sigoden/dufs/archive/refs/tags/v0.4
3
.0.tar.gz
md5sum =
3b71b3d07af69d6ba92c054625dc0dd2
md5sum =
77da2d3e5b5f7f159707db5c93ce8a9d
configure-command = :
configure-command = :
make-binary = cargo install --root=%(location)s --path . --locked
make-binary = cargo install --root=%(location)s --path . --locked
make-targets =
make-targets =
...
...
software/dufs/test/setup.py
View file @
818adb70
...
@@ -43,6 +43,7 @@ setup(
...
@@ -43,6 +43,7 @@ setup(
install_requires
=
[
install_requires
=
[
'slapos.core'
,
'slapos.core'
,
'slapos.libnetworkcache'
,
'slapos.libnetworkcache'
,
'lxml'
,
'requests'
,
'requests'
,
],
],
zip_safe
=
True
,
zip_safe
=
True
,
...
...
software/dufs/test/test.py
View file @
818adb70
...
@@ -25,7 +25,9 @@
...
@@ -25,7 +25,9 @@
#
#
##############################################################################
##############################################################################
import
base64
import
contextlib
import
contextlib
import
json
import
io
import
io
import
os
import
os
import
pathlib
import
pathlib
...
@@ -33,13 +35,15 @@ import subprocess
...
@@ -33,13 +35,15 @@ import subprocess
import
tempfile
import
tempfile
import
urllib.parse
import
urllib.parse
import
requests
import
requests
import
lxml.html
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
pathlib
.
Path
(
__file__
).
parent
.
parent
/
'software.cfg'
)
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
class
TestFileServer
(
SlapOSInstanceTestCase
):
class
TestFileServer
(
SlapOSInstanceTestCase
):
...
@@ -63,6 +67,11 @@ class TestFileServer(SlapOSInstanceTestCase):
...
@@ -63,6 +67,11 @@ class TestFileServer(SlapOSInstanceTestCase):
self
.
addCleanup
(
os
.
unlink
,
ca_cert
.
name
)
self
.
addCleanup
(
os
.
unlink
,
ca_cert
.
name
)
return
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
):
def
test_anonymous_can_only_access_public
(
self
):
resp
=
requests
.
get
(
resp
=
requests
.
get
(
self
.
connection_parameters
[
'public-url'
],
self
.
connection_parameters
[
'public-url'
],
...
@@ -87,12 +96,13 @@ class TestFileServer(SlapOSInstanceTestCase):
...
@@ -87,12 +96,13 @@ class TestFileServer(SlapOSInstanceTestCase):
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'..'
),
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'..'
),
verify
=
self
.
ca_cert
,
verify
=
self
.
ca_cert
,
)
)
self
.
assertIn
(
'pub'
,
resp
.
text
)
self
.
assertEqual
(
self
.
assertNotIn
(
'secret'
,
resp
.
text
)
[
path
[
'name'
]
for
path
in
self
.
_decode_index_content
(
resp
.
text
)[
'paths'
]],
[
'pub'
])
self
.
assertEqual
(
resp
.
status_code
,
requests
.
codes
.
ok
)
self
.
assertEqual
(
resp
.
status_code
,
requests
.
codes
.
ok
)
def
test_index
(
self
):
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'
).
mkdir
()
(
pub
/
'with-index'
/
'index.html'
).
write_text
(
'<html>Hello !</html>'
)
(
pub
/
'with-index'
/
'index.html'
).
write_text
(
'<html>Hello !</html>'
)
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -106,10 +116,14 @@ class TestFileServer(SlapOSInstanceTestCase):
...
@@ -106,10 +116,14 @@ class TestFileServer(SlapOSInstanceTestCase):
(
pub
/
'without-index'
/
'file.txt'
).
write_text
(
'Hello !'
)
(
pub
/
'without-index'
/
'file.txt'
).
write_text
(
'Hello !'
)
self
.
assertIn
(
self
.
assertIn
(
'file.txt'
,
'file.txt'
,
requests
.
get
(
[
path
[
'name'
]
for
path
in
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'without-index/'
),
self
.
_decode_index_content
(
verify
=
self
.
ca_cert
,
requests
.
get
(
).
text
)
urllib
.
parse
.
urljoin
(
self
.
connection_parameters
[
'public-url'
],
'without-index/'
),
verify
=
self
.
ca_cert
,
).
text
)[
'paths'
]
]
)
def
test_upload_file_refused_without_auth
(
self
):
def
test_upload_file_refused_without_auth
(
self
):
parsed_upload_url
=
urllib
.
parse
.
urlparse
(
self
.
connection_parameters
[
'upload-url'
])
parsed_upload_url
=
urllib
.
parse
.
urlparse
(
self
.
connection_parameters
[
'upload-url'
])
...
@@ -168,7 +182,7 @@ class TestFileServer(SlapOSInstanceTestCase):
...
@@ -168,7 +182,7 @@ class TestFileServer(SlapOSInstanceTestCase):
# reprocess instance to get the new certificate, after removing the timestamp
# reprocess instance to get the new certificate, after removing the timestamp
# to force execution
# to force execution
(
pathlib
.
Path
(
self
.
computer_partition_root_path
)
/
'.timestamp'
).
unlink
()
(
self
.
computer_partition_root_path
/
'.timestamp'
).
unlink
()
self
.
waitForInstance
()
self
.
waitForInstance
()
cert_after
=
_getpeercert
()
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