Skip to content

tests/audit_log: cover admin v2 FinalizeUpgrade#30452

Merged
dotnwat merged 1 commit into
redpanda-data:devfrom
dotnwat:CORE-16200
May 13, 2026
Merged

tests/audit_log: cover admin v2 FinalizeUpgrade#30452
dotnwat merged 1 commit into
redpanda-data:devfrom
dotnwat:CORE-16200

Conversation

@dotnwat
Copy link
Copy Markdown
Member

@dotnwat dotnwat commented May 12, 2026

Turns out this one was easy mode.

FeaturesService.FinalizeUpgrade is already audited via the shared apply_auth<> path that admin_server registers for every admin v2 route in add_service(): audit_authn and audit_authz fire at the auth boundary before the service handler runs. Lock that in with a test that drives the RPC and asserts an api_activity record with the expected URL and actor user.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v26.1.x
  • v25.3.x
  • v25.2.x

Release Notes

  • none

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an integration test to ensure Redpanda’s admin v2 FeaturesService.FinalizeUpgrade RPC is captured in audit logging (API activity) when the "admin" audit event type is enabled, and that the resulting audit record attributes the call to the authenticated actor.

Changes:

  • Import admin v2 features_pb2 to construct a FinalizeUpgradeRequest.
  • Add a new audit-log test that issues the admin v2 FinalizeUpgrade RPC and asserts an api_activity record exists with the expected URL and actor username.

Comment thread tests/rptest/tests/audit_log_test.py Outdated
Comment on lines +1079 to +1080
@cluster(num_nodes=4)
def test_admin_v2_finalize_upgrade(self):
Comment on lines +1099 to +1102
try:
admin_v2.features().finalize_upgrade(features_pb2.FinalizeUpgradeRequest())
except Exception as e:
self.logger.debug(f"FinalizeUpgrade returned (expected failure): {e}")
Comment on lines +1113 to +1124
records = self.find_matching_record(
is_finalize_upgrade_record,
lambda count: count >= 1,
"admin v2 FinalizeUpgrade audit record",
)

assert len(records) >= 1, (
f"Expected at least one record, got {len(records)}: {records}"
)
actor = records[0]["actor"]["user"]["name"]
expected = self.redpanda.SUPERUSER_CREDENTIALS[0]
assert actor == expected, f"Expected actor user {expected}, got {actor}"
@vbotbuildovich
Copy link
Copy Markdown
Collaborator

vbotbuildovich commented May 13, 2026

Retry command for Build#84360

please wait until all jobs are finished before running the slash command

/ci-repeat 1
skip-redpanda-build
skip-units
skip-rebase
tests/rptest/tests/audit_log_test.py::AuditLogTestAdminApi.test_admin_v2_finalize_upgrade

@vbotbuildovich
Copy link
Copy Markdown
Collaborator

CI test results

test results on build#84360
test_status test_class test_method test_arguments test_kind job_url passed reason test_history
FAIL AuditLogTestAdminApi test_admin_v2_finalize_upgrade null integration https://buildkite.com/redpanda/redpanda/builds/84360#019e1e77-e489-45b6-aa76-f9110e2300b0 0/11 The test was found to be new, and no failures are allowed https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=AuditLogTestAdminApi&test_method=test_admin_v2_finalize_upgrade
FAIL AuditLogTestAdminApi test_admin_v2_finalize_upgrade null integration https://buildkite.com/redpanda/redpanda/builds/84360#019e1e78-cd4f-49fb-8b20-3e71b8788d7d 0/11 The test was found to be new, and no failures are allowed https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=AuditLogTestAdminApi&test_method=test_admin_v2_finalize_upgrade
FLAKY(PASS) ShadowLinkBasicTests test_link_creation_checks {"source_cluster_spec": {"cluster_type": "kafka", "kafka_quorum": "COMBINED_KRAFT", "kafka_version": "3.8.0"}} integration https://buildkite.com/redpanda/redpanda/builds/84360#019e1e77-e488-4e43-9ecc-9fbfb959d130 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0286, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=ShadowLinkBasicTests&test_method=test_link_creation_checks

Comment thread tests/rptest/tests/audit_log_test.py Outdated
wait_for_version_sync(self.admin, self.redpanda, patch_result["config_version"])

@skip_fips_mode
@cluster(num_nodes=4)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like from the CI failure that this test needs 5 nodes not 4

Suggested change
@cluster(num_nodes=4)
@cluster(num_nodes=5)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh weird i was pretty sure that claude ran this locally.

FeaturesService.FinalizeUpgrade is already audited via the shared
apply_auth<> path that admin_server registers for every admin v2
route in add_service(): audit_authn and audit_authz fire at the
auth boundary before the service handler runs. Lock that in with
a test that drives the RPC and asserts an api_activity record
with the expected URL and actor user.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@dotnwat dotnwat merged commit dc72028 into redpanda-data:dev May 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants