@@ -1257,6 +1257,14 @@ def test_ecosystem(*args)
1257
1257
end
1258
1258
private :test_ecosystem
1259
1259
1260
+ def find_ports_for_pid ( pid )
1261
+ while ( ports = `lsof -P -i 4 -a -p #{ pid } -Fn | grep nlocalhost | cut -d ':' -f 2` . strip ) . empty?
1262
+ sleep 1
1263
+ end
1264
+ puts ports
1265
+ ports
1266
+ end
1267
+
1260
1268
def test_bundle ( *args )
1261
1269
require 'tmpdir'
1262
1270
@@ -1267,8 +1275,12 @@ def test_bundle(*args)
1267
1275
]
1268
1276
gems = %w[ algebrick ]
1269
1277
1270
- gem_server = spawn ( 'gem' , 'server' , '-b' , '127.0.0.1' , '-d' , "#{ gem_test_pack } /gems" )
1278
+ gem_server = spawn ( 'gem' , 'server' , '-b' , '127.0.0.1' , '-p' , '0' , '- d', "#{ gem_test_pack } /gems" )
1271
1279
begin
1280
+ ports = find_ports_for_pid ( gem_server )
1281
+ raise "More than one port opened" if ports . lines . size > 1
1282
+ port = Integer ( ports )
1283
+
1272
1284
bundle_install_flags . each do |install_flags |
1273
1285
puts "Testing Bundler with install flags: #{ install_flags } "
1274
1286
gems . each do |gem_name |
@@ -1289,12 +1301,10 @@ def test_bundle(*args)
1289
1301
# add bin from gem_home to PATH
1290
1302
'PATH' => [ "#{ gem_home } /bin" , ENV [ 'PATH' ] ] . join ( File ::PATH_SEPARATOR ) )
1291
1303
1292
- options = [
1293
- '--experimental-options' ,
1294
- '--exceptions-print-java' ,
1295
- ]
1304
+ options = %w[ --experimental-options --exceptions-print-java ]
1296
1305
1297
- gemserver_source = %w[ --clear-sources --source http://localhost:8808 ]
1306
+ run_ruby ( environment , *args , *options ,
1307
+ '-Sbundle' , 'config' , '--local' , 'mirror.http://localhost:8808' , "http://localhost:#{ port } " )
1298
1308
1299
1309
run_ruby ( environment , *args , *options ,
1300
1310
'-Sbundle' , 'install' , '-V' , *install_flags )
0 commit comments