Skip to content

Commit

Permalink
experiment with direct-tcp arg
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Apr 14, 2020
1 parent 63b4adb commit 3d01a94
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ install:

test_script:
# uncomment to allow remote login to windows ci vm via rdp
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

# lint the python code
# - python -m flake8 jupyterfs setup.py
Expand Down
12 changes: 7 additions & 5 deletions jupyterfs/tests/test_pyfilesystem_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
test_hostname_smb_docker_share = 'TESTNET'
test_name_port_smb_docker_share = 3669

test_direct_tcp_smb_os_share = True
test_host_smb_os_share = socket.gethostbyname_ex(socket.gethostname())[2][-1]
test_smb_port_smb_os_share = 139
test_smb_port_smb_os_share = 445

_test_file_model = {
'content': test_content,
Expand Down Expand Up @@ -209,6 +210,7 @@ def teardown_method(self, method):

def _createContentsManager(self):
kwargs = dict(
direct_tcp=test_direct_tcp_smb_os_share,
host=test_host_smb_os_share,
hostname=socket.getfqdn(),
passwd=samba.smb_passwd,
Expand All @@ -217,11 +219,11 @@ def _createContentsManager(self):
)

if test_smb_port_smb_os_share is not None:
uri = 'smb://{username}:{passwd}@{host}:{port}/{share}?hostname={hostname}'.format(port=test_smb_port_smb_os_share, **kwargs)
cm = PyFilesystemContentsManager.open_fs(uri)
uri = 'smb://{username}:{passwd}@{host}:{port}/{share}?hostname={hostname}&direct-tcp={direct_tcp}'.format(port=test_smb_port_smb_os_share, **kwargs)
else:
uri = 'smb://{username}:{passwd}@{host}/{share}?hostname={hostname}'.format(**kwargs)
cm = PyFilesystemContentsManager.open_fs(uri)
uri = 'smb://{username}:{passwd}@{host}/{share}?hostname={hostname}&direct-tcp={direct_tcp}'.format(**kwargs)

cm = PyFilesystemContentsManager.open_fs(uri)

assert cm.dir_exists('.')
return cm
3 changes: 3 additions & 0 deletions jupyterfs/tests/utils/samba.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class RootDirUtil:
def __init__(
self,
dir_name,
direct_tcp=False,
host=None,
hostname=None,
my_name='local',
Expand All @@ -94,6 +95,7 @@ def __init__(
self.hostname = socket.getfqdn() if hostname is None else hostname

self.dir_name = dir_name
self.direct_tcp = direct_tcp
self.my_name = my_name
self.name_port = name_port
self.smb_port = smb_port
Expand Down Expand Up @@ -133,6 +135,7 @@ def resource(self):
password=smb_passwd,
my_name=self.my_name,
remote_name=self.hostname,
is_direct_tcp=self.direct_tcp,
)

conn = SMBConnection(**kwargs)
Expand Down

0 comments on commit 3d01a94

Please sign in to comment.