Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.druid.data.input.impl.JsonInputFormat;
import org.apache.druid.indexing.kafka.simulate.KafkaResource;
import org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpec;
import org.apache.druid.indexing.kafka.supervisor.KafkaSupervisorSpecBuilder;
import org.apache.druid.indexing.overlord.supervisor.SupervisorStatus;
import org.apache.druid.indexing.seekablestream.supervisor.BoundedStreamConfig;
import org.apache.druid.query.DruidMetrics;
Expand All @@ -39,6 +40,10 @@
*/
public class KafkaBoundedSupervisorTest extends StreamIndexTestBase
{
// Allow two minutes for bounded-supervisor cold start, ingestion, and segment publication on CI.
// This is a maximum wait, not a fixed delay; successful waits return as soon as the metric is emitted.
private static final long BOUNDED_SUPERVISOR_INGESTION_TIMEOUT_MILLIS = 120_000L;

private final KafkaResource kafkaServer = new KafkaResource();

@Override
Expand All @@ -47,6 +52,16 @@ protected StreamIngestResource<?> getStreamIngestResource()
return kafkaServer;
}

@Override
protected KafkaSupervisorSpecBuilder createKafkaSupervisor(KafkaResource kafkaServer)
{
// Use a moderate segment size to avoid the shared fixture's one-row segment rollover overhead while
// retaining normal segment publication behavior. These tests assert offsets, row counts, and supervisor
// state, not segment count, so 100 does not change their semantics.
return super.createKafkaSupervisor(kafkaServer)
.withTuningConfig(tuningConfig -> tuningConfig.withMaxRowsPerSegment(100));
}

@Override
protected EmbeddedDruidCluster createCluster()
{
Expand Down Expand Up @@ -89,7 +104,7 @@ public void test_boundedSupervisor_ingestsDataAndCompletes()

// Bounded supervisor cold start (post supervisor -> schedule task -> consume -> publish) can exceed
// the cluster default wait on CI; give it a generous ceiling.
waitUntilPublishedRecordsAreIngested(totalRecords, 120_000L);
waitUntilPublishedRecordsAreIngested(totalRecords, BOUNDED_SUPERVISOR_INGESTION_TIMEOUT_MILLIS);

// Wait for supervisor to transition to COMPLETED state
waitForSupervisorToComplete(supervisor.getId());
Expand Down Expand Up @@ -203,7 +218,7 @@ public void test_boundedSupervisor_withMismatchedMetadata_is_unhealthy()
cluster.callApi().postSupervisor(supervisor1);

// Wait for records to be ingested (approximately 200 records total from both partitions)
waitUntilPublishedRecordsAreIngested(200);
waitUntilPublishedRecordsAreIngested(200, BOUNDED_SUPERVISOR_INGESTION_TIMEOUT_MILLIS);

// Wait for supervisor to transition to COMPLETED state
waitForSupervisorToComplete(supervisor1.getId());
Expand Down Expand Up @@ -265,7 +280,7 @@ public void test_boundedSupervisor_doesNotSilentlyCompleteWhenStaleOffsetExceeds
final KafkaSupervisorSpec supervisor1 = createBoundedKafkaSupervisor(kafkaServer, topic, boundedConfig1);

cluster.callApi().postSupervisor(supervisor1);
waitUntilPublishedRecordsAreIngested(250);
waitUntilPublishedRecordsAreIngested(250, BOUNDED_SUPERVISOR_INGESTION_TIMEOUT_MILLIS);
waitForSupervisorToComplete(supervisor1.getId());

final SupervisorStatus status1 = cluster.callApi().getSupervisorStatus(supervisor1.getId());
Expand Down
Loading