Skip to content

Commit 2bb9d65

Browse files
authored
Merge pull request #3181 from IntersectMBO/simplify_issue_blocked_checks
refactor(blockers): unify issue blocked logic
2 parents f30d1ed + 2108ad3 commit 2bb9d65

File tree

6 files changed

+18
-74
lines changed

6 files changed

+18
-74
lines changed

.github/node_upgrade.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ printf "start: %(%H:%M:%S)T\n" -1
7474
# update cardano-node to specified revision
7575
# If BASE_TAR_URL is set, instead of using nix, download and extract binaries for base revision
7676
# from a published tarball to save disk space, and use the same nix env as will be used for
77-
# UPGRADE_REVISION. We are running out of space on Github Actions runners.
77+
# UPGRADE_REVISION. We are running out of space on GitHub Actions runners.
7878
if [[ -z "${BASE_TAR_URL:-""}" && -n "${BASE_REVISION:-""}" ]]; then
7979
NODE_OVERRIDE=$(node_override "${BASE_REVISION}")
8080
elif [ -n "${UPGRADE_REVISION:-""}" ]; then
@@ -174,7 +174,7 @@ fi
174174
175175
_cleanup
176176
177-
# prepare artifacts for upload in Github Actions
177+
# prepare artifacts for upload in GitHub Actions
178178
if [ -n "${GITHUB_ACTIONS:-""}" ]; then
179179
# save testing artifacts
180180
./.github/save_artifacts.sh

.github/regression.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fi
252252

253253
_cleanup
254254

255-
# prepare artifacts for upload in Github Actions
255+
# prepare artifacts for upload in GitHub Actions
256256
if [ -n "${GITHUB_ACTIONS:-""}" ]; then
257257

258258
# move reports to root dir

.github/workflows/regression_reusable.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
password: ${{secrets.GMAIL_PASSWORD}}
174174
subject: "Status: ${{ steps.testing-step.outcome }}; workflow: ${{ github.workflow }}"
175175
to: ${{secrets.CI_FAIL_MAILS}}
176-
from: Cardano Github Actions
176+
from: Cardano GitHub Actions
177177
body: "Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
178178
179179
attachments: testrun-report.html

.github/workflows/upgrade_reusable.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
password: ${{secrets.GMAIL_PASSWORD}}
111111
subject: "Status: ${{ steps.testing-step.outcome }}; workflow: ${{ github.workflow }}"
112112
to: ${{secrets.CI_FAIL_MAILS}}
113-
from: Cardano Github Actions
113+
from: Cardano GitHub Actions
114114
body: "Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
115115
116116
attachments: testrun-report.html

cardano_node_tests/utils/blockers.py

Lines changed: 12 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,16 @@ def __init__(
4141
self.gh_issue = gh_issue.GHIssue(number=self.issue, repo=self.repo)
4242

4343
self.is_blocked: tp.Callable[[], bool]
44-
if self.repo == "IntersectMBO/cardano-node":
45-
self.is_blocked = self._node_issue_is_blocked
46-
elif self.repo == "IntersectMBO/cardano-cli":
44+
if self.repo == "IntersectMBO/cardano-cli":
4745
self.is_blocked = self._cli_issue_is_blocked
4846
elif self.repo == "IntersectMBO/cardano-db-sync":
4947
self.is_blocked = self._dbsync_issue_is_blocked
5048
else:
5149
self.is_blocked = self._issue_is_blocked
5250

53-
def _node_issue_is_blocked(self) -> bool:
54-
"""Check if node issue is blocked."""
55-
# Assume that the issue is blocked if no Github token was provided and so the check
51+
def _issue_blocked_in_version(self, product_version: version.Version) -> bool:
52+
"""Check if an issue is blocked in given product version."""
53+
# Assume that the issue is blocked if no GitHub token was provided and so the check
5654
# cannot be performed.
5755
if not self.gh_issue.TOKEN:
5856
LOGGER.warning(
@@ -65,78 +63,24 @@ def _node_issue_is_blocked(self) -> bool:
6563
if not self.gh_issue.is_closed():
6664
return True
6765

68-
# The issue is blocked if it was fixed in a node version that is greater than
69-
# the node version we are currently running.
70-
if self.fixed_in and version.parse(self.fixed_in) > VERSIONS.node: # noqa:SIM103
66+
# The issue is blocked if it was fixed or integrated into a product version that is greater
67+
# than the product version we are currently running.
68+
if self.fixed_in and version.parse(self.fixed_in) > product_version: # noqa:SIM103
7169
return True
7270

7371
return False
7472

7573
def _cli_issue_is_blocked(self) -> bool:
76-
"""Check if generic issue is blocked."""
77-
# Assume that the issue is blocked if no Github token was provided and so the check
78-
# cannot be performed.
79-
if not self.gh_issue.TOKEN:
80-
LOGGER.warning(
81-
"No GitHub token provided, cannot check if issue '%s' is blocked",
82-
f"{self.repo}#{self.issue}",
83-
)
84-
return True
85-
86-
# The issue is blocked if it is was not closed yet
87-
if not self.gh_issue.is_closed():
88-
return True
89-
90-
# The issue is blocked if it was fixed in a cli version that is greater than
91-
# the cli version we are currently running.
92-
if self.fixed_in and version.parse(self.fixed_in) > VERSIONS.cli: # noqa:SIM103
93-
return True
94-
95-
return False
74+
"""Check if cardano-cli issue is blocked."""
75+
return self._issue_blocked_in_version(VERSIONS.cli)
9676

9777
def _dbsync_issue_is_blocked(self) -> bool:
9878
"""Check if dbsync issue is blocked."""
99-
# Assume that the issue is blocked if no Github token was provided and so the check
100-
# cannot be performed.
101-
if not self.gh_issue.TOKEN:
102-
LOGGER.warning(
103-
"No GitHub token provided, cannot check if issue '%s' is blocked",
104-
f"{self.repo}#{self.issue}",
105-
)
106-
return True
107-
108-
# The issue is blocked if it is was not closed yet
109-
if not self.gh_issue.is_closed():
110-
return True
111-
112-
# The issue is blocked if it was fixed in a dbsync version that is greater than
113-
# the dbsync version we are currently running.
114-
if self.fixed_in and version.parse(self.fixed_in) > VERSIONS.dbsync: # noqa:SIM103
115-
return True
116-
117-
return False
79+
return self._issue_blocked_in_version(VERSIONS.dbsync)
11880

11981
def _issue_is_blocked(self) -> bool:
120-
"""Check if generic issue is blocked."""
121-
# Assume that the issue is blocked if no Github token was provided and so the check
122-
# cannot be performed.
123-
if not self.gh_issue.TOKEN:
124-
LOGGER.warning(
125-
"No GitHub token provided, cannot check if issue '%s' is blocked",
126-
f"{self.repo}#{self.issue}",
127-
)
128-
return True
129-
130-
# The issue is blocked if it is was not closed yet
131-
if not self.gh_issue.is_closed():
132-
return True
133-
134-
# The issue is blocked if the fix was integrated into a node version that is greater than
135-
# the node version we are currently running.
136-
if self.fixed_in and version.parse(self.fixed_in) > VERSIONS.node: # noqa:SIM103
137-
return True
138-
139-
return False
82+
"""Check if an issue is blocked."""
83+
return self._issue_blocked_in_version(VERSIONS.node)
14084

14185
def finish_test(self) -> None:
14286
"""Fail or Xfail test with GitHub issue reference."""

src_docs/source/test_results/nightly_system_tests.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Test statuses
1818
Nightly results
1919
---------------
2020

21-
`Results on Github Actions <https://github.com/IntersectMBO/cardano-node-tests/actions?query=workflow%3A%22Nightly+tests%22+event%3Aschedule+branch%3Amaster++>`__
21+
`Results on GitHub Actions <https://github.com/IntersectMBO/cardano-node-tests/actions?query=workflow%3A%22Nightly+tests%22+event%3Aschedule+branch%3Amaster++>`__
2222

2323
* `nightly <https://cardano-tests-reports-3-74-115-22.nip.io/cardano-node-tests-nightly/>`__: |nightly-badge|
2424
* network in Conway era

0 commit comments

Comments
 (0)