Skip to content

Commit

Permalink
Merge pull request redpanda-data#16097 from graphcareful/test-produce…
Browse files Browse the repository at this point in the history
…-debug

rptest: Additional logging audit_log_test infra
  • Loading branch information
dotnwat authored Jan 17, 2024
2 parents a99419e + aa21eb7 commit 55a487e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/rptest/tests/audit_log_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ def is_finished(self):

mapper = MessageMapper(self.redpanda.logger, filter_fn, stop_cond,
self.ocsf_server)
self.redpanda.logger.debug("Starting audit_log consumer...")
consumer = self.get_rpk_consumer(topic=self.audit_log, offset='oldest')
consumer.start()

Expand All @@ -591,9 +592,15 @@ def predicate():
wait_until(predicate,
timeout_sec=timeout_sec,
backoff_sec=backoff_sec)
except Exception as e:
actual = self.aggregate_count(mapper.records)
self.logger.error(
f"Failed waiting on records, observed: {actual} records")
raise e
finally:
consumer.stop()
consumer.free()
self.redpanda.logger.debug("audit_log consumer has stopped")
return mapper.records

def find_matching_record(self, filter_fn, valid_check_fn, desc):
Expand All @@ -619,12 +626,8 @@ def find_matching_record(self, filter_fn, valid_check_fn, desc):
"""
stop_cond = lambda records: valid_check_fn(
self.aggregate_count(records))
records = self.read_all_from_audit_log(filter_fn=filter_fn,
stop_cond=stop_cond)
assert valid_check_fn(
self.aggregate_count(records)
), f'Expected {desc}, Actual: {self.aggregate_count(records)}'
return records
return self.read_all_from_audit_log(filter_fn=filter_fn,
stop_cond=stop_cond)


class AuditLogTestsAppLifecycle(AuditLogTestBase):
Expand Down

0 comments on commit 55a487e

Please sign in to comment.