Skip to content

Commit ceee2ea

Browse files
fix(release-controller): stop integration test asserting live NNS state (#2102)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent c44d1d8 commit ceee2ea

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

release-controller/tests/test_reconciler_integration.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,36 @@ def get_past_election_proposals(self) -> list[ElectionProposal]:
7676
]
7777

7878

79+
# The NNS proposals that really elected GuestOS for the two most recent
80+
# releases of the default fixture index below.
81+
#
82+
# ``MockDashboard`` cannot supply these: its ``_fake_proposal`` always emits
83+
# ``hostos_version_to_elect``, whatever ``os_type`` it is handed, so it only
84+
# ever populates the HostOS half of :func:`dre_cli.proposals_by_version`. The
85+
# GuestOS half was therefore left to ``dryrun.DRECli``, which does *not*
86+
# override ``get_past_election_proposals`` and so shells out to the real
87+
# ``dre proposals filter -t ic-os-version-election`` against the live
88+
# governance canister. That query returns only the 100 most recent election
89+
# proposals, so the moment one of these two scrolled out of the window the
90+
# tests started asserting against whatever the chain happened to hold that
91+
# minute -- the same commit passed CI at one push and failed at the next.
92+
# Pin them instead.
93+
_FIXTURE_GUESTOS_ELECTION_PROPOSALS: dict[str, int] = {
94+
"45657852c1eca6728ff313808db29b47c862ad13": 138814,
95+
"206b61a8616bc93d36d6a014e5cc8edf1ba256ae": 138708,
96+
}
97+
98+
99+
class StubDRECli(dryrun.DRECli):
100+
"""``dryrun.DRECli`` with the live governance canister query stubbed out."""
101+
102+
def get_past_election_proposals(self) -> list[ElectionProposal]:
103+
return [
104+
_guestos_election_proposal(proposal_id, version)
105+
for version, proposal_id in _FIXTURE_GUESTOS_ELECTION_PROPOSALS.items()
106+
]
107+
108+
79109
class MockActiveVersionProvider(object):
80110
def __init__(self, active_versions: list[str] | None = None):
81111
self.vers = active_versions if active_versions else []
@@ -125,7 +155,7 @@ def _defaults_for_test(
125155
dryrun.ReleaseNotesClient(),
126156
ReconcilerState(),
127157
MockActiveVersionProvider(),
128-
dryrun.DRECli(),
158+
StubDRECli(),
129159
dryrun.MockSlackAnnouncer(),
130160
StaticReleaseLoader(
131161
pydantic_yaml.to_yaml_str(

0 commit comments

Comments
 (0)