File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 33from __future__ import unicode_literals
44
55from random import randint
6+ import time
7+ import os
68
79try :
810 import unittest2 as unittest # py26
@@ -104,6 +106,24 @@ def user_name(self):
104106 self .assertIn ('X-User' , sub_client .headers )
105107 self .assertEqual (sub_client .headers ['X-User' ], 'algolia' )
106108
109+ def test_dns_timeout (self ):
110+ app_id = os .environ ['ALGOLIA_APPLICATION_ID' ]
111+
112+ hosts = [
113+ '%s-dsn.algolia.biz' % app_id ,
114+ '%s-dsn.algolia.net' % app_id ,
115+ '%s-1.algolianet.com' % app_id ,
116+ '%s-2.algolianet.com' % app_id ,
117+ '%s-3.algolianet.com' % app_id ,
118+ ]
119+
120+ client = Client (app_id , os .environ ['ALGOLIA_API_KEY' ], hosts )
121+ client .set_timeout (5 , 2 )
122+
123+ now = time .time ()
124+ indices = client .list_indexes ()
125+ self .assertLess (now + 5 , time .time ())
126+
107127
108128class ClientWithDataTest (ClientTest ):
109129 """Tests that use two index with initial data."""
You can’t perform that action at this time.
0 commit comments