Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
build: false

platform:
- x64

environment:
matrix:
- PYTHON_VERSION: 3.5
MINICONDA_DIRNAME: C:\Miniconda3-x64

matrix:
fast_finish: false

init:
- ECHO %PYTHON_VERSION% %MINICONDA_DIRNAME%

install:
- cmd: set "PATH=%MINICONDA_DIRNAME%;%MINICONDA_DIRNAME%\\Scripts;%PATH%"
- cmd: conda config --set always_yes true
- cmd: conda update --quiet conda
- cmd: conda info --all
- cmd: conda create --quiet --name conda-env-%PYTHON_VERSION% python=%PYTHON_VERSION%
- cmd: activate conda-env-%PYTHON_VERSION%
- cmd: pip install --disable-pip-version-check --user --upgrade pip
- cmd: pip install -e .
- cmd: pip install pytest pytest-xdist

test_script:
- cmd: pytest -n 8 -sv
3 changes: 2 additions & 1 deletion docs/source/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ always take this into account:
#. osBrain uses `pickle <https://docs.python.org/library/pickle.html>`_ for
serialization by default, which means that the system performance may as
well depend on this package. Serialization is configurable, though.
#. osBrain default transport is IPC by default, but :ref:`it can be changed
#. osBrain default transport is IPC for operating systems that provide UNIX
domain sockets, and TCP for the rest. :ref:`It can be changed
globally or configured specifically for each bind <transport_protocol>`.
Note, however, that when using TCP, the network may have a great impact
on performance.
3 changes: 2 additions & 1 deletion docs/source/transport_protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Transport protocol
Available transports
====================

Althought the default transport protocol is IPC, there are other transport
Althought the default transport protocol is IPC for operating systems that
provide UNIX domain sockets and TCP for the rest, there are other transport
protocols that can be used in osBrain:

- ``tcp``: common `TCP <https://en.wikipedia.org/wiki/Transmission_Control_Protocol>`_. Can always be used, and must be used to communicate agents running in
Expand Down
43 changes: 35 additions & 8 deletions osbrain/tests/test_agent_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from shutil import rmtree
from tempfile import mkdtemp
from uuid import uuid4
import pytest

import osbrain
from osbrain import Agent
Expand All @@ -24,46 +25,71 @@ def test_agent_bind_transport_global(nsproxy):
# Default transport
agent = run_agent('a0')
address = agent.bind('PUSH')
assert address.transport == 'ipc'
assert address.transport == osbrain.config['TRANSPORT']


# Changing default global transport
def test_agent_bind_transport_global_tcp(nsproxy):
"""
Test global transport TCP.
"""
osbrain.config['TRANSPORT'] = 'tcp'
agent = run_agent('a1')
agent = run_agent('a0')
address = agent.bind('PUSH')
assert address.transport == 'tcp'


@pytest.mark.skipif(os.name != 'posix', reason='IPC transport not available')
def test_agent_bind_transport_global_ipc(nsproxy):
"""
Test global transport IPC.
"""
osbrain.config['TRANSPORT'] = 'ipc'
agent = run_agent('a2')
agent = run_agent('a0')
address = agent.bind('PUSH')
assert address.transport == 'ipc'


def test_agent_bind_transport_agent(nsproxy):
def test_agent_bind_transport_agent_tcp(nsproxy):
"""
Test agent default transport.
Test agent TCP transport.
"""
agent = run_agent('a0', transport='tcp')
address = agent.bind('PUSH')
assert address.transport == 'tcp'


@pytest.mark.skipif(os.name != 'posix', reason='IPC transport not available')
def test_agent_bind_transport_agent_ipc(nsproxy):
"""
Test agent IPC transport.
"""
agent = run_agent('a1', transport='ipc')
address = agent.bind('PUSH')
assert address.transport == 'ipc'


def test_agent_bind_transport_bind(nsproxy):
def test_agent_bind_transport_tcp(nsproxy):
"""
Test bind transport.
Test TCP bind transport.
"""
agent = run_agent('a0')

address = agent.bind('PUSH', transport='tcp')
assert address.transport == 'tcp'


@pytest.mark.skipif(os.name != 'posix', reason='IPC transport not available')
def test_agent_bind_transport_inproc(nsproxy):
"""
Test inproc bind transport.
"""
agent = run_agent('a0')

address = agent.bind('PUSH', transport='inproc')
assert address.transport == 'inproc'


@pytest.mark.skipif(os.name != 'posix', reason='IPC transport not available')
def test_agent_bind_given_address(nsproxy):
"""
Test agent binding to an specified address using TCP and IPC transport
Expand All @@ -90,6 +116,7 @@ def test_agent_bind_given_address(nsproxy):
assert address.address == tcp_addr


@pytest.mark.skipif(os.name != 'posix', reason='IPC transport not available')
def test_agent_ipc_from_different_folders(nsproxy):
"""
IPC should work well even when agents are run from different folders.
Expand Down