def testGetGossip(result): """ Check that a get forces a gossip. This test works regardless of the LB's hash algorithm because the test directly gets from the DB instance, forcing it to merge any pending gossip. """ if active['ndb'] <= 1: result({'type': 'TEST_SKIPPED', 'reason': 'Only 1 database (no gossip)'}) base = 'aardvark' first = base+'0' vc = VectorClock().update('c0', 1) put(first, 1, vc) dbId = getDBId(first) if dbId == -1: result({'type': 'KEY_NOT_SAVED'}) return dbsub = dbSubscriber(dbId) for i in range(1,active['digest-length']+1): item = base + str(i) put(item, 1, vc, dbPort(dbId)) result({'type': 'bool', 'expected': False, 'got': clients[dbsub].exists(base+'*')}) rating, _, _ = get('hello', port=dbPort(dbsub)) result({'type': 'float', 'expected': 0.0, 'got': rating}) rating, choices, clocks = get(first, port=dbPort(dbsub)) result({'type': 'float', 'expected': 1.0, 'got': rating}) result({'type': 'EXPECT_CHOICES', 'expected': [1.0], 'got': choices}) result({'type': 'EXPECT_CLOCKS', 'expected': [vc.asDict()], 'got': [c.asDict() for c in clocks]})