def test_multi_conn_pool(client): g = Graph().traversal() t = g.V() message = RequestMessage('traversal', 'bytecode', { 'gremlin': t.bytecode, 'aliases': { 'g': 'gmodern' } }) message2 = RequestMessage('traversal', 'bytecode', { 'gremlin': t.bytecode, 'aliases': { 'g': 'gmodern' } }) client = Client('ws://localhost:45940/gremlin', 'g', pool_size=1) future = client.submitAsync(message) future2 = client.submitAsync(message2) result_set2 = future2.result() assert len(result_set2.all().result()) == 6 # with connection pool `future` may or may not be done here result_set = future.result() assert len(result_set.all().result()) == 6
def test_connection_share(client): # Overwrite fixture with pool_size=1 client client = Client('ws://localhost:45940/gremlin', 'gmodern', pool_size=1) g = Graph().traversal() t = g.V() message = RequestMessage('traversal', 'bytecode', { 'gremlin': t.bytecode, 'aliases': { 'g': 'gmodern' } }) message2 = RequestMessage('traversal', 'bytecode', { 'gremlin': t.bytecode, 'aliases': { 'g': 'gmodern' } }) future = client.submitAsync(message) future2 = client.submitAsync(message2) result_set2 = future2.result() assert len(result_set2.all().result()) == 6 # This future has to finish for the second to yield result - pool_size=1 assert future.done() result_set = future.result() assert len(result_set.all().result()) == 6
def test_multi_conn_pool(client): g = Graph().traversal() t = g.V() message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}}) message2 = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}}) client = Client('ws://localhost:45940/gremlin', 'g', pool_size=1) future = client.submitAsync(message) future2 = client.submitAsync(message2) result_set2 = future2.result() assert len(result_set2.all().result()) == 6 # with connection pool `future` may or may not be done here result_set = future.result() assert len(result_set.all().result()) == 6
def test_connection_share(client): # Overwrite fixture with pool_size=1 client client = Client('ws://localhost:45940/gremlin', 'gmodern', pool_size=1) g = Graph().traversal() t = g.V() message = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}}) message2 = RequestMessage('traversal', 'bytecode', {'gremlin': t.bytecode, 'aliases': {'g': 'gmodern'}}) future = client.submitAsync(message) future2 = client.submitAsync(message2) result_set2 = future2.result() assert len(result_set2.all().result()) == 6 # This future has to finish for the second to yield result - pool_size=1 assert future.done() result_set = future.result() assert len(result_set.all().result()) == 6