@@ -171,29 +171,62 @@ def test_start_container_inherits_options_from_constructor(self):
171171 def test_start_container_creates_links (self ):
172172 db = self .create_service ('db' )
173173 web = self .create_service ('web' , links = [(db , None )])
174+
175+ db .start_container ()
174176 db .start_container ()
175177 web .start_container ()
176- self .assertIn ('figtest_db_1' , web .containers ()[0 ].links ())
177- self .assertIn ('db_1' , web .containers ()[0 ].links ())
178+
179+ self .assertEqual (
180+ set (web .containers ()[0 ].links ()),
181+ set ([
182+ 'figtest_db_1' , 'db_1' ,
183+ 'figtest_db_2' , 'db_2' ,
184+ 'db' ,
185+ ]),
186+ )
178187
179188 def test_start_container_creates_links_with_names (self ):
180189 db = self .create_service ('db' )
181190 web = self .create_service ('web' , links = [(db , 'custom_link_name' )])
191+
192+ db .start_container ()
182193 db .start_container ()
183194 web .start_container ()
184- self .assertIn ('custom_link_name' , web .containers ()[0 ].links ())
195+
196+ self .assertEqual (
197+ set (web .containers ()[0 ].links ()),
198+ set ([
199+ 'figtest_db_1' , 'db_1' ,
200+ 'figtest_db_2' , 'db_2' ,
201+ 'custom_link_name' ,
202+ ]),
203+ )
185204
186205 def test_start_normal_container_does_not_create_links_to_its_own_service (self ):
187206 db = self .create_service ('db' )
188- c1 = db .start_container ()
189- c2 = db .start_container ()
190- self .assertNotIn (c1 .name , c2 .links ())
207+
208+ db .start_container ()
209+ db .start_container ()
210+
211+ c = db .start_container ()
212+ self .assertEqual (set (c .links ()), set ([]))
191213
192214 def test_start_one_off_container_creates_links_to_its_own_service (self ):
193215 db = self .create_service ('db' )
194- c1 = db .start_container ()
195- c2 = db .start_container (one_off = True )
196- self .assertIn (c1 .name , c2 .links ())
216+
217+ db .start_container ()
218+ db .start_container ()
219+
220+ c = db .start_container (one_off = True )
221+
222+ self .assertEqual (
223+ set (c .links ()),
224+ set ([
225+ 'figtest_db_1' , 'db_1' ,
226+ 'figtest_db_2' , 'db_2' ,
227+ 'db' ,
228+ ]),
229+ )
197230
198231 def test_start_container_builds_images (self ):
199232 service = Service (
0 commit comments