Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
04e8a863
Commit
04e8a863
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3bf9cf0d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
wcfs/__init__.py
wcfs/__init__.py
+6
-1
wcfs/wcfs.go
wcfs/wcfs.go
+1
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+30
-2
No files found.
wcfs/__init__.py
View file @
04e8a863
...
...
@@ -45,6 +45,9 @@ class WCFS(object):
self
.
mountpoint
=
mountpoint
self
.
_fwcfs
=
fwcfs
def
close
(
self
):
self
.
_fwcfs
.
close
()
# serve starts and runs wcfs server for ZODB @ zurl.
#
...
...
@@ -106,7 +109,9 @@ def join(zurl, autostart=None):
return
_start
(
zurl
)
# XXX doc -> WCFS
# _start starts wcfs server for ZODB @ zurl.
#
# _start(zurl) -> WCFS
def
_start
(
zurl
):
mntpt
=
_mntpt_4zurl
(
zurl
)
log
.
info
(
"wcfs: starting for %s ..."
,
zurl
)
...
...
wcfs/wcfs.go
View file @
04e8a863
...
...
@@ -250,6 +250,7 @@ import (
)
// option to prevent starting if wcfs was already started ?
// option to automatically exit/unmount if there are no requests for some t (UC: autospawned from join)
func
main
()
{
log
.
SetPrefix
(
"wcfs: "
)
...
...
wcfs/wcfs_test.py
View file @
04e8a863
...
...
@@ -21,17 +21,39 @@
from
wendelin.lib.testing
import
getTestDB
from
wendelin
import
wcfs
from
golang
import
go
,
chan
import
os
,
os
.
path
,
subprocess
from
pytest
import
raises
testdb
=
None
testzurl
=
None
def
setup_module
():
global
testdb
global
testdb
,
testzurl
,
testmntpt
testdb
=
getTestDB
()
testdb
.
setup
()
zstor
=
testdb
.
getZODBStorage
()
testzurl
=
wcfs
.
_zstor_2zurl
(
zstor
)
zstor
.
close
()
testmntpt
=
wcfs
.
_mntpt_4zurl
(
testzurl
)
os
.
rmdir
(
testmntpt
)
def
teardown_module
():
testdb
.
teardown
()
# make sure we start every test without wcfs server running
def
setup_function
(
f
):
assert
not
os
.
path
.
exists
(
testmntpt
)
# make sure we unmount wcfs after every function
def
teardown_function
(
f
):
mounted
=
not
subprocess
.
call
([
"mountpoint"
,
"-q"
,
testmntpt
])
if
mounted
:
subprocess
.
check_call
([
"fusermount"
,
"-u"
,
testmntpt
])
if
os
.
path
.
exists
(
testmntpt
):
os
.
rmdir
(
testmntpt
)
# readfile reads file @ path.
def
readfile
(
path
):
with
open
(
path
)
as
f
:
...
...
@@ -46,7 +68,13 @@ def test_join():
wc
=
wcfs
.
_start
(
zurl
)
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
#wc = wcfs.join(zurl, autostart=False)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
assert
wc2
.
mountpoint
==
wc
.
mountpoint
wc
.
close
()
wc2
.
close
()
zstor
.
close
()
def
test_join_autostart
():
...
...
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