ci: use a different starting port for the hg server web server processes in the different tests, to minimise the chances of conflicts

This commit is contained in:
Delyan Angelov 2025-05-15 12:14:49 +03:00
parent 226e1d6442
commit 0b547598f5
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
3 changed files with 5 additions and 5 deletions

View file

@ -183,7 +183,7 @@ fn test_install_from_hg_url() ! {
os.write_file(os.join_path(test_module_path, '.hg/hgrc'), '[ui]\nusername = v_ci <v_ci@example.net>\nverbose = False\n')!
println('> writing .hg/hgrc done.')
mut p, mut port := test_utils.hg_serve(hg_path, test_module_path)
mut p, mut port := test_utils.hg_serve(hg_path, test_module_path, 2000)
// Trying to install it should fail.
res = os.execute('${vexe} install --hg http://127.0.0.1:${port}')
p.signal_kill()
@ -198,7 +198,7 @@ fn test_install_from_hg_url() ! {
os.chdir(test_module_path)!
cmd_ok(@LOCATION, 'hg add')
cmd_ok(@LOCATION, 'hg commit -m "add v.mod"')
p, port = test_utils.hg_serve(hg_path, test_module_path)
p, port = test_utils.hg_serve(hg_path, test_module_path, 3000)
// Trying to install the module should work now.
res = cmd_ok(@LOCATION, '${vexe} install --hg http://127.0.0.1:${port}')
p.signal_kill()

View file

@ -148,7 +148,7 @@ fn test_install_from_hg_url_with_version_tag() ! {
cmd_ok(@LOCATION, 'hg add')
cmd_ok(@LOCATION, 'hg commit -m "bump version to v0.2.0"')
mut p, port := test_utils.hg_serve(hg_path, test_module_path)
mut p, port := test_utils.hg_serve(hg_path, test_module_path, 4000)
res = os.execute('${vexe} install -v --hg http://127.0.0.1:${port}@v0.1.0')
p.signal_kill()
if res.exit_code != 0 {

View file

@ -12,8 +12,8 @@ pub fn set_test_env(test_path string) {
unbuffer_stdout()
}
pub fn hg_serve(hg_path string, path string) (&os.Process, int) {
mut port := 8000
pub fn hg_serve(hg_path string, path string, start_port int) (&os.Process, int) {
mut port := start_port
for {
if mut l := net.listen_tcp(.ip6, ':${port}') {
l.close() or { panic(err) }