Skip to content

Commit

Permalink
ducktape/cloud_storage: Wait for topic info
Browse files Browse the repository at this point in the history
The test asserts that rpk can describe topic, however there are test
runs where the topic creation happens slightly after the topic info is
requested.

This change wraps the describe operation in a wait loop so that the
describe op is retried until it succeeds.

(cherry picked from commit 99830f0)
  • Loading branch information
abhijat authored and vbotbuildovich committed Oct 16, 2023
1 parent 64cd00f commit 10f95cf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/rptest/tests/e2e_shadow_indexing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,15 @@ def test_recover_after_delete_records(self):
assert response[0].error_msg == '', f"Err msg: {response[0].error_msg}"
assert new_lwm == response[0].new_start_offset, response[
0].new_start_offset

def topic_info_populated():
return len(list(rpk.describe_topic(self.topic))) == 1

wait_until(topic_info_populated,
timeout_sec=60,
backoff_sec=1,
err_msg=f"topic info not available for {self.topic}")

topics_info = list(rpk.describe_topic(self.topic))
assert len(topics_info) == 1
assert topics_info[0].start_offset == new_lwm, topics_info
Expand Down Expand Up @@ -611,6 +620,11 @@ def manifest_has_start_override():
wait_until(lambda: len(set(rpk.list_topics())) == 1,
timeout_sec=30,
backoff_sec=1)

wait_until(topic_info_populated,
timeout_sec=60,
backoff_sec=1,
err_msg=f"topic info not available for {self.topic}")
topics_info = list(rpk.describe_topic(self.topic))
assert len(topics_info) == 1
assert topics_info[0].start_offset == new_lwm, topics_info
Expand Down

0 comments on commit 10f95cf

Please sign in to comment.