Skip to content

Commit

Permalink
Include cardano-node version info in report.html
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoura committed Aug 12, 2020
1 parent 56393f6 commit 014ff6d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
14 changes: 14 additions & 0 deletions cardano_node_tests/tests/conftest.py
Expand Up @@ -18,6 +18,20 @@ def pytest_addoption(parser):
)


def pytest_html_report_title(report):
cardano_version = helpers.get_cardano_version()
report.title = (
f"cardano-node {cardano_version['cardano-node']} (git rev {cardano_version['git_rev']})"
)


def pytest_configure(config):
cardano_version = helpers.get_cardano_version()
config._metadata["cardano-node"] = cardano_version["cardano-node"]
config._metadata["cardano-node rev"] = cardano_version["git_rev"]
config._metadata["ghc"] = cardano_version["ghc"]


# session scoped fixtures


Expand Down
2 changes: 0 additions & 2 deletions cardano_node_tests/tests/test_transactions.py
Expand Up @@ -220,7 +220,6 @@ def test_transaction_to_10_addrs(self, cluster_session, payment_addrs):
), f"Incorrect balance for destination address `{addr}`"


@pytest.mark.first
class TestNotBalanced:
@pytest.fixture(scope="class")
def payment_addr_rec(self, cluster_session):
Expand Down Expand Up @@ -343,7 +342,6 @@ def test_negative_fee(cluster_session, addrs_data_session):
assert "option --fee: cannot parse value" in str(excinfo.value)


@pytest.mark.first
def test_past_ttl(cluster_session, addrs_data_session):
"""Send a transaction with ttl in the past."""
cluster = cluster_session
Expand Down
16 changes: 15 additions & 1 deletion cardano_node_tests/utils/helpers.py
Expand Up @@ -65,9 +65,23 @@ def run_shell_command(command: str, workdir: FileType = ""):
cmd = f"bash -c '{command}'"
cmd = cmd if not workdir else f"cd {workdir}; {cmd}"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
__, stderr = p.communicate()
stdout, stderr = p.communicate()
if p.returncode != 0:
raise AssertionError(f"An error occurred while running `{cmd}`: {stderr.decode()}")
return stdout


def get_cardano_version():
out = run_shell_command("cardano-node --version").decode().strip()
env_info, git_info, *__ = out.splitlines()
node, platform, ghc, *__ = env_info.split(" - ")
version = {
"cardano-node": node.split(" ")[-1],
"platform": platform,
"ghc": ghc,
"git_rev": git_info.split(" ")[-1],
}
return version


def fund_from_genesis(
Expand Down

0 comments on commit 014ff6d

Please sign in to comment.