mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 10:28:10 +01:00
Log rotation.
This commit is contained in:
@@ -408,9 +408,8 @@ class Test(unittest.TestCase):
|
||||
settings_path = os.path.join(basicswap_dir, cfg.CONFIG_FILENAME)
|
||||
with open(settings_path) as fs:
|
||||
settings = json.load(fs)
|
||||
fp = open(os.path.join(basicswap_dir, "basicswap.log"), "w")
|
||||
sc = BasicSwap(
|
||||
fp, basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
)
|
||||
cls.swap_clients.append(sc)
|
||||
sc.setDaemonPID(Coins.BTC, cls.daemons[0].handle.pid)
|
||||
@@ -423,7 +422,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
sc.start()
|
||||
|
||||
t = HttpThread(sc.fp, TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
cls.http_threads.append(t)
|
||||
t.start()
|
||||
|
||||
@@ -484,7 +483,6 @@ class Test(unittest.TestCase):
|
||||
t.join()
|
||||
for c in cls.swap_clients:
|
||||
c.finalise()
|
||||
c.fp.close()
|
||||
|
||||
stopDaemons(cls.daemons)
|
||||
|
||||
|
||||
@@ -325,9 +325,7 @@ class Test(unittest.TestCase):
|
||||
settings_path = os.path.join(basicswap_dir, cfg.CONFIG_FILENAME)
|
||||
with open(settings_path) as fs:
|
||||
settings = json.load(fs)
|
||||
fp = open(os.path.join(basicswap_dir, "basicswap.log"), "w")
|
||||
sc = BasicSwap(
|
||||
fp,
|
||||
basicswap_dir,
|
||||
settings,
|
||||
"regtest",
|
||||
@@ -338,7 +336,7 @@ class Test(unittest.TestCase):
|
||||
sc.setDaemonPID(Coins.PART, cls.part_daemons[i].handle.pid)
|
||||
sc.start()
|
||||
|
||||
t = HttpThread(sc.fp, TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
cls.http_threads.append(t)
|
||||
t.start()
|
||||
|
||||
@@ -397,7 +395,6 @@ class Test(unittest.TestCase):
|
||||
t.join()
|
||||
for c in cls.swap_clients:
|
||||
c.finalise()
|
||||
c.fp.close()
|
||||
|
||||
stopDaemons(cls.part_daemons)
|
||||
stopDaemons(cls.btc_daemons)
|
||||
|
||||
@@ -365,9 +365,8 @@ class Test(unittest.TestCase):
|
||||
settings_path = os.path.join(basicswap_dir, cfg.CONFIG_FILENAME)
|
||||
with open(settings_path) as fs:
|
||||
settings = json.load(fs)
|
||||
fp = open(os.path.join(basicswap_dir, "basicswap.log"), "w")
|
||||
sc = BasicSwap(
|
||||
fp, basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
)
|
||||
cls.swap_clients.append(sc)
|
||||
|
||||
@@ -376,7 +375,7 @@ class Test(unittest.TestCase):
|
||||
sc.setDaemonPID(Coins.PART, cls.daemons[2 + i].handle.pid)
|
||||
sc.start()
|
||||
|
||||
t = HttpThread(sc.fp, TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
cls.http_threads.append(t)
|
||||
t.start()
|
||||
|
||||
@@ -437,7 +436,6 @@ class Test(unittest.TestCase):
|
||||
t.join()
|
||||
for c in cls.swap_clients:
|
||||
c.finalise()
|
||||
c.fp.close()
|
||||
|
||||
stopDaemons(cls.daemons)
|
||||
cls.http_threads.clear()
|
||||
|
||||
@@ -414,9 +414,8 @@ class Test(unittest.TestCase):
|
||||
settings_path = os.path.join(basicswap_dir, cfg.CONFIG_FILENAME)
|
||||
with open(settings_path) as fs:
|
||||
settings = json.load(fs)
|
||||
fp = open(os.path.join(basicswap_dir, "basicswap.log"), "w")
|
||||
sc = BasicSwap(
|
||||
fp, basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
basicswap_dir, settings, "regtest", log_name="BasicSwap{}".format(i)
|
||||
)
|
||||
cls.swap_clients.append(sc)
|
||||
sc.setDaemonPID(Coins.BTC, cls.daemons[0].handle.pid)
|
||||
@@ -424,7 +423,7 @@ class Test(unittest.TestCase):
|
||||
sc.setDaemonPID(Coins.PART, cls.daemons[2 + i].handle.pid)
|
||||
sc.start()
|
||||
|
||||
t = HttpThread(sc.fp, TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
cls.http_threads.append(t)
|
||||
t.start()
|
||||
|
||||
@@ -482,7 +481,6 @@ class Test(unittest.TestCase):
|
||||
t.join()
|
||||
for c in cls.swap_clients:
|
||||
c.finalise()
|
||||
c.fp.close()
|
||||
|
||||
stopDaemons(cls.daemons)
|
||||
cls.http_threads.clear()
|
||||
|
||||
@@ -654,9 +654,7 @@ class BaseTest(unittest.TestCase):
|
||||
if cls.restore_instance and i == 1:
|
||||
cls.network_key = settings["network_key"]
|
||||
cls.network_pubkey = settings["network_pubkey"]
|
||||
fp = open(os.path.join(basicswap_dir, "basicswap.log"), "w")
|
||||
sc = BasicSwap(
|
||||
fp,
|
||||
basicswap_dir,
|
||||
settings,
|
||||
"regtest",
|
||||
@@ -684,7 +682,7 @@ class BaseTest(unittest.TestCase):
|
||||
# Import a random seed to keep the existing test behaviour. BTC core rescans even with timestamp: now.
|
||||
sc.ci(Coins.BTC).initialiseWallet(random.randbytes(32))
|
||||
|
||||
t = HttpThread(sc.fp, TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
|
||||
cls.http_threads.append(t)
|
||||
t.start()
|
||||
# Set future block rewards to nowhere (a random address), so wallet amounts stay constant
|
||||
@@ -952,7 +950,6 @@ class BaseTest(unittest.TestCase):
|
||||
logging.info("Stopping swap clients")
|
||||
for c in cls.swap_clients:
|
||||
c.finalise()
|
||||
c.fp.close()
|
||||
|
||||
logging.info("Stopping coin nodes")
|
||||
stopDaemons(cls.xmr_daemons)
|
||||
|
||||
Reference in New Issue
Block a user