From b0e169a549eb2eb1de90edb9e00b91747ca6b073 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Mon, 11 Jul 2022 16:05:25 +0200 Subject: [PATCH] Minor fixes re: tests and logs - Adds a log to signal the tower is ready - Updates the message to wait for in tests - Removes unnecessary logs in tls - Sets tests to run in SLOW MACHINE mode, given tests tend to fail in CI apparently due to that --- .github/workflows/cln-plugin.yaml | 2 +- teos/src/main.rs | 1 + teos/src/tls.rs | 2 -- watchtower-plugin/tests/conftest.py | 2 +- watchtower-plugin/tests/test.py | 6 ++++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cln-plugin.yaml b/.github/workflows/cln-plugin.yaml index 6386bc9..11300c4 100644 --- a/.github/workflows/cln-plugin.yaml +++ b/.github/workflows/cln-plugin.yaml @@ -61,4 +61,4 @@ jobs: - name: Run tests run: | cd watchtower-plugin/tests - DEVELOPER=1 poetry run pytest test.py -s + DEVELOPER=1 SLOW_MACHINE=1 poetry run pytest test.py -s diff --git a/teos/src/main.rs b/teos/src/main.rs index 5e89cd4..4602186 100644 --- a/teos/src/main.rs +++ b/teos/src/main.rs @@ -304,6 +304,7 @@ async fn main() { })); } + log::info!("Tower ready"); chain_monitor.monitor_chain().await; // Wait until shutdown diff --git a/teos/src/tls.rs b/teos/src/tls.rs index c94dc7a..d126a40 100644 --- a/teos/src/tls.rs +++ b/teos/src/tls.rs @@ -76,7 +76,6 @@ fn generate_or_load_identity( &key_path ); let keypair = KeyPair::generate(&rcgen::PKCS_ECDSA_P256_SHA256)?; - // std::fs::write(&key_path, keypair.serialize_pem())?; log::debug!( "Generating a new certificate for key {:?} at {:?}", @@ -106,7 +105,6 @@ fn generate_or_load_identity( Some(ca) => cert.serialize_pem_with_signer(&Certificate::try_from(ca)?)?, }, )?; - log::info!("writing certificate to file"); } let key = std::fs::read(&key_path)?; diff --git a/watchtower-plugin/tests/conftest.py b/watchtower-plugin/tests/conftest.py index eec1c5a..ef7fac8 100644 --- a/watchtower-plugin/tests/conftest.py +++ b/watchtower-plugin/tests/conftest.py @@ -80,7 +80,7 @@ class TeosD(TailableProc): if overwrite_key: self.cmd_line.append("--overwritekey") TailableProc.start(self) - self.wait_for_log("Bootstrap completed. Turning on interfaces", timeout=TIMEOUT) + self.wait_for_log("Tower ready", timeout=TIMEOUT) logging.info("TeosD started") def stop(self): diff --git a/watchtower-plugin/tests/test.py b/watchtower-plugin/tests/test.py index 862e97b..d8a67cd 100644 --- a/watchtower-plugin/tests/test.py +++ b/watchtower-plugin/tests/test.py @@ -104,9 +104,11 @@ def test_unreachable_watchtower(node_factory, bitcoind, teosd): assert l2.rpc.gettowerinfo(tower_id)["status"] == "temporary_unreachable" assert l2.rpc.gettowerinfo(tower_id)["pending_appointments"] - # Start the tower and check the automatic backoff works + # Start the tower and check the automatic backoff works (wait while are pending appointments) teosd.start() - time.sleep(max_interval_time * 2) + while l2.rpc.gettowerinfo(tower_id)["pending_appointments"]: + time.sleep(1) + assert l2.rpc.gettowerinfo(tower_id)["status"] == "reachable" assert not l2.rpc.gettowerinfo(tower_id)["pending_appointments"]