'Tests that EP Timeouts are honored.
@since 3.5
@jira_ticket PYTHON-569
@expected_result EP timeouts should override defaults
@test_category config_profiles'

@local
def test_add_profile_timeout(self):

    max_retry_count = 10
    for i in range(max_retry_count):
        node1 = ExecutionProfile(load_balancing_policy=HostFilterPolicy(RoundRobinPolicy(), (lambda host: (host.address == '127.0.0.1'))))
        with Cluster(execution_profiles={EXEC_PROFILE_DEFAULT: node1}) as cluster:
            session = cluster.connect(wait_for_all_pools=True)
            pools = session.get_pool_state()
            self.assertGreater(len(cluster.metadata.all_hosts()), 2)
            self.assertEqual(set((h.address for h in pools)), set(('127.0.0.1',)))
            node2 = ExecutionProfile(load_balancing_policy=HostFilterPolicy(RoundRobinPolicy(), (lambda host: (host.address in ['127.0.0.2', '127.0.0.3']))))
            start = time.time()
            try:
                self.assertRaises(cassandra.OperationTimedOut, cluster.add_execution_profile, 'profile_{0}'.format(i), node2, pool_wait_timeout=sys.float_info.min)
                break
            except AssertionError:
                end = time.time()
                self.assertAlmostEqual(start, end, 1)
    else:
        raise Exception("add_execution_profile    didn't    timeout    after    {0}    retries".format(max_retry_count))
