Unit Test Results.

Designed for use with JUnit and Ant.

All Failures

ClassNameStatusTypeTime(s)
8_cythonno_x86_64_12_64test_movementFailureAssertionError: values not within 5.00% of the max: (649.14, 612.08) ()

self = <topology_test.TestTopology object at 0x7fa7fb9a3b20>

@pytest.mark.no_vnodes
def test_movement(self):
cluster = self.cluster

# Create an unbalanced ring
cluster.populate(3, tokens=[0, 2**48, 2**62]).start()
node1, node2, node3 = cluster.nodelist()

session = self.patient_cql_connection(node1)
create_ks(session, 'ks', 1)
create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'})

insert_c1c2(session, n=30000, consistency=ConsistencyLevel.ONE)

cluster.flush()

# Move nodes to balance the cluster
def move_node(node, token):
mark = node.mark_log()
node.move(token) # can't assume 0 is balanced with m3p
node.watch_log_for('{} state jump to NORMAL'.format(node.address_for_current_version()), from_mark=mark, timeout=180)
time.sleep(3)

balancing_tokens = cluster.balanced_tokens(3)

move_node(node1, balancing_tokens[0])
move_node(node2, balancing_tokens[1])
move_node(node3, balancing_tokens[2])

time.sleep(1)
cluster.cleanup()
for node in cluster.nodelist():
# after moving nodes we need to relocate any tokens in the wrong places, and after doing that
# we might have overlapping tokens on the disks, so run a major compaction to get balance even
if cluster.version() >= '3.2':
node.nodetool("relocatesstables")
node.nodetool("compact")

# Check we can get all the keys
for n in range(0, 30000):
query_c1c2(session, n, ConsistencyLevel.ONE)

# Now the load should be basically even
sizes = [node.data_size() for node in [node1, node2, node3]]

> assert_almost_equal(sizes[0], sizes[1], error=0.05)

topology_test.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (649.14, 612.08), kwargs = {'error': 0.05}, error = 0.05, vmax = 649.14
vmin = 612.08, error_message = ''

def assert_almost_equal(*args, **kwargs):
"""
Assert variable number of arguments all fall within a margin of error.
@params *args variable number of numerical arguments to check
@params error Optional margin of error. Default 0.16
@params error_message Optional error message to print. Default ''

Examples:
assert_almost_equal(sizes[2], init_size)
assert_almost_equal(ttl_session1, ttl_session2[0][0], error=0.005)
"""
error = kwargs['error'] if 'error' in kwargs else 0.16
vmax = max(args)
vmin = min(args)
error_message = '' if 'error_message' not in kwargs else kwargs['error_message']
> assert vmin > vmax * (1.0 - error) or vmin == vmax, \
"values not within {:.2f}% of the max: {} ({})".format(error * 100, args, error_message)
E AssertionError: values not within 5.00% of the max: (649.14, 612.08) ()

tools/assertions.py:205: AssertionError
125.848