'Test that the connector handles temporary mongos failure'

def test_mongos_connection_failure(self):

    client = self.cluster.client()
    coll = client.test.test
    coll.insert_one({'doc': 1})
    assert_soon((lambda : (len(self.dm._search()) == 1)))
    self.connector.main_conn.close()
    time.sleep(5)
    coll.insert_one({'doc': 2})
    assert_soon((lambda : (len(self.dm._search()) == 2)))
    self.connector.main_conn = self.connector.create_authed_client()
    coll.insert_one({'doc': 3})
    assert_soon((lambda : (len(self.dm._search()) == 3)))
    client.close()
