Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joowani committed Aug 22, 2016
1 parent 26ad6a8 commit 2166fec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
12 changes: 6 additions & 6 deletions arango/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ def handle_request(self, request, handler):
:raises arango.exceptions.ClusterTestError: if the cluster round-trip
test cannot be executed
"""
request.headers['X-Shard-ID'] = self._shard_id
request.headers['X-Shard-ID'] = str(self._shard_id)
if self._trans_id is not None:
request.headers['X-Client-Transaction-ID'] = self._trans_id
request.headers['X-Client-Transaction-ID'] = str(self._trans_id)
if self._timeout is not None:
request.headers['X-Timeout'] = self._timeout
if self._sync is not None:
request.headers['X-Synchronous-Mode'] = self._sync
request.headers['X-Timeout'] = str(self._timeout)
if self._sync is True:
request.headers['X-Synchronous-Mode'] = 'true'

request.endpoint = '/_admin/cluster-test' + request.endpoint + '11'
res = getattr(self, request.method)(**request.kwargs)
if res.status_code not in HTTP_OK:
raise ClusterTestError(res)
return res.body
return res.body # pragma: no cover

@property
def aql(self):
Expand Down
23 changes: 13 additions & 10 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ def teardown_module(*_):
arango_client.delete_database(db_name, ignore_missing=True)


def setup_function(*_):
col.truncate()


def wait_on_job(job):
while job.status() == 'pending':
pass


@pytest.mark.order1
def test_async_object():
cluster = db.cluster(
Expand All @@ -47,8 +38,20 @@ def test_async_object():
timeout=2000,
sync=False
)

assert cluster.type == 'cluster'
assert 'ArangoDB cluster round-trip test' in repr(cluster)
assert isinstance(cluster.aql, AQL)
assert isinstance(cluster.graph(graph_name), Graph)
assert isinstance(cluster.collection(col_name), Collection)


@pytest.mark.order2
def test_cluster_execute():
cluster = db.cluster(
shard_id='foo',
transaction_id='bar',
timeout=2000,
sync=True
)
with pytest.raises(ClusterTestError):
cluster.collection(col_name).checksum()

0 comments on commit 2166fec

Please sign in to comment.