Skip to content

Commit

Permalink
added start_smb_os_windows.ps1 script to windows ci
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Apr 7, 2020
1 parent 8412523 commit a6dc353
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
12 changes: 12 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ parameters:
- script: curl http://127.0.0.1:9000/
displayName: 'Test local S3 server'

- name: initSmbOsWindows
type: stepList
default:
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: 'ci/start_smb_os_windows.ps1'
errorActionPreference: 'stop'
failOnStderr: True
displayName: 'Expose share on os builtin samba server'

- name: testSteps
type: stepList
default:
Expand Down Expand Up @@ -150,6 +161,7 @@ jobs:
python.version: '3.7'

steps:
- ${{ parameters.initSmbOsWindows }}
- ${{ parameters.initS3proxySteps }}
- ${{ parameters.initSteps }}
- ${{ parameters.testSteps }}
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion jupyterfs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
PLATFORMS = set(PLATFORM_INFO.keys())

def pytest_configure(config):
# register the platform markers
for info in PLATFORM_INFO.items():
# register one of the platform markers
config.addinivalue_line(
"markers", "{}: mark test to run only on platform == {}".format(*info)
)
Expand Down
32 changes: 19 additions & 13 deletions jupyterfs/tests/test_pyfilesystem_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
test_content = 'foo\nbar\nbaz'
test_fname = 'foo.txt'

test_endpoint_url_s3 = 'http://127.0.0.1:9000'
test_endpoint_url_smb = '127.0.0.1'
test_name_port_smb = 3669
test_root_osfs = 'osfs_local'

test_endpoint_url_s3 = 'http://127.0.0.1:9000'

test_endpoint_url_smb_docker_share = '127.0.0.1'
test_name_port_smb_docker_share = 3669

test_endpoint_url_smb_os_share = '127.0.0.1'

_test_file_model = {
'content': test_content,
'format': 'text',
Expand Down Expand Up @@ -124,12 +128,16 @@ def _createContentsManager(self):

@pytest.mark.darwin
@pytest.mark.linux
class TestPyFilesystemContentsManager_samba_docker_share(_TestBase):
class TestPyFilesystemContentsManager_smb_docker_share(_TestBase):
"""(mac/linux only. future: windows) runs its own samba server via
py-docker. Automatically creates and exposes a share from a docker
container
"""
_rootDirUtil = samba.RootDirUtil(dir_name=test_dir, endpoint_url=test_endpoint_url_smb, name_port=test_name_port_smb)
_rootDirUtil = samba.RootDirUtil(
dir_name=test_dir,
endpoint_url=test_endpoint_url_smb_docker_share,
name_port=test_name_port_smb_docker_share,
)

@classmethod
def setup_class(cls):
Expand All @@ -156,8 +164,8 @@ def _createContentsManager(self):
uri = 'smb://{username}:{passwd}@{host}/{share}?name-port={name_port}'.format(
username=samba.smb_user,
passwd=samba.smb_passwd,
host=test_endpoint_url_smb,
name_port=test_name_port_smb,
host=test_endpoint_url_smb_docker_share,
name_port=test_name_port_smb_docker_share,
share=test_dir,
)

Expand All @@ -167,11 +175,11 @@ def _createContentsManager(self):


@pytest.mark.win32
class TestPyFilesystemContentsManager_samba_os_share(_TestBase):
class TestPyFilesystemContentsManager_smb_os_share(_TestBase):
"""(windows only. future: also mac) Uses the os's buitlin samba server.
Creates and expose a share locally
"""
_rootDirUtil = samba.RootDirUtil(dir_name=test_dir, endpoint_url=test_endpoint_url_smb, name_port=test_name_port_smb)
_rootDirUtil = samba.RootDirUtil(dir_name=test_dir, endpoint_url=test_endpoint_url_smb_os_share)

@classmethod
def setup_class(cls):
Expand All @@ -187,15 +195,13 @@ def teardown_method(self, method):
self._rootDirUtil.delete()

def _createContentsManager(self):
uri = 'smb://{username}:{passwd}@{host}/{share}?name-port={name_port}'.format(
uri = 'smb://{username}:{passwd}@{host}/{share}'.format(
username=samba.smb_user,
passwd=samba.smb_passwd,
host=test_endpoint_url_smb,
name_port=test_name_port_smb,
host=test_endpoint_url_smb_os_share,
share=test_dir,
)

cm = PyFilesystemContentsManager.open_fs(uri)
assert cm.dir_exists('.')
return cm

4 changes: 0 additions & 4 deletions jupyterfs/tests/utils/samba.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ def startServer(host=None, name_port=137):
('445/tcp', 445),
))

if host is not None:
for key, val in ports.items():
ports[key] = (host, val)

# init docker
docker_client = docker.from_env(version='auto')
docker_client.info()
Expand Down

0 comments on commit a6dc353

Please sign in to comment.