From f3309b26682051ae3cfc8e3c86bdb44456e4cba1 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 25 May 2016 15:38:25 -0400 Subject: [PATCH] nitrpg&nitcorn: replace `rand` with `NIT_TESTING_ID` for their tests Signed-off-by: Jean Privat --- contrib/nitrpg/src/test_helper.nit | 3 ++- tests/test_nitcorn.nit | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/nitrpg/src/test_helper.nit b/contrib/nitrpg/src/test_helper.nit index 1ac8314..904862c 100644 --- a/contrib/nitrpg/src/test_helper.nit +++ b/contrib/nitrpg/src/test_helper.nit @@ -57,7 +57,8 @@ abstract class NitrpgTestHelper # Gen a test db with a random name (to avoid race conditions). fun gen_test_db: MongoDb do - var db_name = "test_nitrpg_{get_time}_{1000.rand}" + var testid = "NIT_TESTING_ID".environ.to_i + var db_name = "test_nitrpg_{testid}" var db = load_db(db_name) test_dbs.add db return db diff --git a/tests/test_nitcorn.nit b/tests/test_nitcorn.nit index e4088a2..5f2ca1c 100644 --- a/tests/test_nitcorn.nit +++ b/tests/test_nitcorn.nit @@ -17,8 +17,8 @@ import pthreads redef class Sys var iface: String is lazy do - srand - return "localhost:{10000+20000.rand}" + var testid = "NIT_TESTING_ID".environ.to_i + return "localhost:{10000+testid}" end var fs_path: String = getcwd / "../lib/nitcorn/examples/www/hello_world/dir" is lazy -- 1.7.9.5