@@ -1203,6 +1203,10 @@ def check_version(self, timeout=2, strict=False, topics=[]):
12031203 stashed [key ] = self .config [key ]
12041204 self .config [key ] = override_config [key ]
12051205
1206+ def reset_override_configs ():
1207+ for key in stashed :
1208+ self .config [key ] = stashed [key ]
1209+
12061210 # kafka kills the connection when it doesn't recognize an API request
12071211 # so we can send a test request and then follow immediately with a
12081212 # vanilla MetadataRequest. If the server did not recognize the first
@@ -1222,6 +1226,7 @@ def check_version(self, timeout=2, strict=False, topics=[]):
12221226
12231227 for version , request in test_cases :
12241228 if not self .connect_blocking (timeout_at - time .time ()):
1229+ reset_override_configs ()
12251230 raise Errors .NodeNotReadyError ()
12261231 f = self .send (request )
12271232 # HACK: sleeping to wait for socket to send bytes
@@ -1278,10 +1283,10 @@ def check_version(self, timeout=2, strict=False, topics=[]):
12781283 log .info ("Broker is not v%s -- it did not recognize %s" ,
12791284 version , request .__class__ .__name__ )
12801285 else :
1286+ reset_override_configs ()
12811287 raise Errors .UnrecognizedBrokerVersion ()
12821288
1283- for key in stashed :
1284- self .config [key ] = stashed [key ]
1289+ reset_override_configs ()
12851290 return version
12861291
12871292 def __str__ (self ):
0 commit comments