'Test to validate that client trace contains client ip information.
creates a simple query and ensures that the client trace information is present. This will
only be the case if the c* version is 2.2 or greater
@since 2.6.0
@jira_ticket PYTHON-435
@expected_result client address should be present in C* >= 2.2, otherwise should be none.
@test_category tracing
#The current version on the trunk doesn\'t have the version set to 2.2 yet.
#For now we will use the protocol version. Once they update the version on C* trunk
#we can use the C*. See below
#self._cass_version, self._cql_version = get_server_versions()
#if self._cass_version < (2, 2):
#   raise unittest.SkipTest("Client IP was not present in trace until C* 2.2")'

@local
@greaterthanprotocolv3
def test_client_ip_in_trace(self):

    query = 'SELECT    *    FROM    system.local'
    statement = SimpleStatement(query)
    response_future = self.session.execute_async(statement, trace=True)
    response_future.result()
    trace = response_future.get_query_trace(max_wait=10.0)
    client_ip = trace.client
    pat = re.compile('127.0.0.\\d{1,3}')
    self.assertIsNotNone(client_ip, 'Client    IP    was    not    set    in    trace    with    C*    >=    2.2')
    self.assertTrue(pat.match(client_ip), 'Client    IP    from    trace    did    not    match    the    expected    value')
