Skip to content

Commit

Permalink
tests: split the test in two
Browse files Browse the repository at this point in the history
A system test should do a single thing at once otherwise
it make the code hard to read.

So this is doing it.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Nov 18, 2024
1 parent 9a5564e commit e9fec47
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions tests/test_bolt1-02-unknown-messages.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#! /usr/bin/env python3
# Init exchange, with unknown messages
#
import pyln.spec.bolt1

from typing import Any

from lnprototest import TryAll, Connect, ExpectMsg, Msg, RawMsg, Runner
from lnprototest.event import ExpectDisconnect
import pyln.spec.bolt1
from typing import Any
from lnprototest.utils import run_runner


def test_unknowns(runner: Runner, namespaceoverride: Any) -> None:
Expand All @@ -20,6 +22,17 @@ def test_unknowns(runner: Runner, namespaceoverride: Any) -> None:
# - upon receiving a message of _odd_, unknown type:
# - MUST ignore the received message.
RawMsg(bytes.fromhex("270F")),
]
run_runner(runner, test)


def test_unknowns_even_message(runner: Runner, namespaceoverride: Any) -> None:
# We override default namespace since we only need BOLT1
namespaceoverride(pyln.spec.bolt1.namespace)
test = [
Connect(connprivkey="03"),
ExpectMsg("init"),
Msg("init", globalfeatures="", features=""),
# BOLT #1:
# A receiving node:...
# - upon receiving a message of _even_, unknown type:
Expand All @@ -28,5 +41,4 @@ def test_unknowns(runner: Runner, namespaceoverride: Any) -> None:
RawMsg(bytes.fromhex("2710")),
ExpectDisconnect(),
]

runner.run(test)
run_runner(runner, test)

0 comments on commit e9fec47

Please sign in to comment.