Closed liuzix closed 2 years ago
panic: listen tcp [127.0.0.1:34589](http://127.0.0.1:34589/): bind: address already in use [recovered] panic: listen tcp [127.0.0.1:34589](http://127.0.0.1:34589/): bind: address already in use goroutine 195 [running]: testing.tRunner.func1.2({0x3a7e060, 0xc000d591d0}) /home/zixiong/.gvm/gos/go1.18/src/testing/testing.go:1389 +0x366 testing.tRunner.func1() /home/zixiong/.gvm/gos/go1.18/src/testing/testing.go:1392 +0x5d2 panic({0x3a7e060, 0xc000d591d0}) /home/zixiong/.gvm/gos/go1.18/src/runtime/panic.go:844 +0x258 [github.com/hanfei1991/microcosm/lib.MockBaseMaster](http://github.com/hanfei1991/microcosm/lib.MockBaseMaster)({0x3e1ad28, 0x1a}, {0x5291038, 0xc0000185a0}) /home/zixiong/microcosm/lib/mock_master_util.go:36 +0x3b6 [github.com/hanfei1991/microcosm/lib.NewMockMasterImpl](http://github.com/hanfei1991/microcosm/lib.NewMockMasterImpl)({0x0, 0x0}, {0x3e1ad28, 0x1a}) /home/zixiong/microcosm/lib/mock_master_impl.go:59 +0x29e [github.com/hanfei1991/microcosm/servermaster.TestJobManagerQueryJob(0x0?)](http://github.com/hanfei1991/microcosm/servermaster.TestJobManagerQueryJob(0x0?)) /home/zixiong/microcosm/servermaster/jobmanager_test.go:170 +0x2bc testing.tRunner(0xc000602b60, 0x3efa820) /home/zixiong/.gvm/gos/go1.18/src/testing/testing.go:1439 +0x214 created by testing.(*T).Run /home/zixiong/.gvm/gos/go1.18/src/testing/testing.go:1486 +0x725 FAIL [github.com/hanfei1991/microcosm/servermaster](http://github.com/hanfei1991/microcosm/servermaster) 1.534s
It's the problem of concurrent golang test. There is a time slice between getting an available port and using a port. I will fix it.