'Trigger and ensure unavailables are counted
Write a key, value pair. Stop a node with the coordinator node knowing about the "DOWN" state.
Attempt an insert/read at cl.ALL and receive a Unavailable Exception.'

def test_unavailable(self):

    self.session.execute('INSERT    INTO    test    (k,    v)    VALUES    (1,    1)')
    query = SimpleStatement('SELECT    *    FROM    test    WHERE    k=1', consistency_level=ConsistencyLevel.ALL)
    results = execute_until_pass(self.session, query)
    self.assertTrue(results)
    get_node(1).stop(wait=True, wait_other_notice=True)
    time.sleep(5)
    try:
        query = SimpleStatement('INSERT    INTO    test    (k,    v)    VALUES    (2,    2)', consistency_level=ConsistencyLevel.ALL)
        with self.assertRaises(Unavailable):
            self.session.execute(query)
        self.assertEqual(self.cluster.metrics.stats.unavailables, 1)
        query = SimpleStatement('SELECT    *    FROM    test', consistency_level=ConsistencyLevel.ALL)
        with self.assertRaises(Unavailable):
            self.session.execute(query, timeout=None)
        self.assertEqual(self.cluster.metrics.stats.unavailables, 2)
    finally:
        get_node(1).start(wait_other_notice=True, wait_for_binary_proto=True)
        time.sleep(5)
    self.cluster.shutdown()
