mirror of https://github.com/docker/docker-py.git
				
				
				
			Retry on connection error
This commit is contained in:
		
							parent
							
								
									f75afc92a2
								
							
						
					
					
						commit
						8aded4842b
					
				| 
						 | 
					@ -2148,10 +2148,17 @@ class StreamTest(Cleanup, unittest.TestCase):
 | 
				
			||||||
            b'\r\n'
 | 
					            b'\r\n'
 | 
				
			||||||
        ) + b'\r\n'.join(lines)
 | 
					        ) + b'\r\n'.join(lines)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        client = docker.Client(base_url="http+unix:/" + self.socket_file)
 | 
					        client = docker.Client(base_url="http+unix://" + self.socket_file)
 | 
				
			||||||
        stream = client.build(
 | 
					        for i in range(5):
 | 
				
			||||||
            path=os.path.dirname(self.build_context),
 | 
					            try:
 | 
				
			||||||
            stream=True)
 | 
					                stream = client.build(
 | 
				
			||||||
 | 
					                    path=os.path.dirname(self.build_context),
 | 
				
			||||||
 | 
					                    stream=True
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					                break
 | 
				
			||||||
 | 
					            except requests.ConnectionError as e:
 | 
				
			||||||
 | 
					                if i == 4:
 | 
				
			||||||
 | 
					                    raise e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertEqual(list(stream), [
 | 
					        self.assertEqual(list(stream), [
 | 
				
			||||||
            str(i).encode() for i in range(50)])
 | 
					            str(i).encode() for i in range(50)])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue