Skip to content

Commit

Permalink
Fix tests failures when LND node is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Nov 14, 2023
1 parent 5f67f8f commit e2aba11
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/django-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
max-parallel: 4
matrix:
python-tag: ['3.11.6-slim-bookworm', '3.12-slim-bookworm']
lnd-version: ["v0.17.0-beta"] # , "v0.17.0-beta.rc1"]
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: satackey/[email protected]
continue-on-error: true
with:
key: coordinator-docker-cache-${{ hashFiles('./Dockerfile') }}
key: coordinator-docker-cache-${{ hashFiles('./Dockerfile', './requirements.txt', './requirements_dev.txt') }}
restore-keys: |
coordinator-docker-cache-
Expand All @@ -46,13 +46,11 @@ jobs:
with:
compose-file: "./docker-tests.yml"
down-flags: "--volumes"
# Ideally we run only coordinator-${{ matrix.ln-vendor }} , at the moment some tests fail if LND is not around.
services: |
bitcoind
postgres
redis
coordinator-CLN
coordinator-LND
coordinator-${{ matrix.ln-vendor }}
robot-LND
coordinator
env:
Expand Down
2 changes: 1 addition & 1 deletion api/lightning/cln.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_version(cls):
return response.version
except Exception as e:
print(f"Cannot get CLN version: {e}")
return None
return "Not installed"

@classmethod
def get_info(cls):
Expand Down
4 changes: 2 additions & 2 deletions api/lightning/lnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def get_version(cls):
log("verstub.GetVersion", request, response)
return "v" + response.version
except Exception as e:
print(e)
return None
print(f"Cannot get CLN version: {e}")
return "Not installed"

@classmethod
def decode_payreq(cls, invoice):
Expand Down
4 changes: 2 additions & 2 deletions api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def get_lnd_version():

return LNDNode.get_version()
except Exception:
return "No LND"
return "Not installed"


cln_version_cache = {}
Expand All @@ -194,7 +194,7 @@ def get_cln_version():

return CLNNode.get_version()
except Exception:
return "No CLN"
return "Not installed"


robosats_commit_cache = {}
Expand Down
3 changes: 2 additions & 1 deletion tests/node_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ def connect_to_node(node_name, node_id, ip_port):
headers=node["headers"],
)
if response.json() == {}:
print("Peered robot node to coordinator node!")
return response.json()
else:
if "already connected to peer" in response.json()["message"]:
return response.json()
print(f"Could not connect to coordinator node: {response.json()}")
print(f"Could not peer coordinator node: {response.json()}")
time.sleep(wait_step)


Expand Down

0 comments on commit e2aba11

Please sign in to comment.