You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by yh...@apache.org on 2025/06/23 16:26:37 UTC
(beam) branch master updated: Fix PubsubIOLT (#35372)
This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 0d6c94a8727 Fix PubsubIOLT (#35372)
0d6c94a8727 is described below
commit 0d6c94a8727627ee295a13b1736ceda4137f8aa3
Author: akashorabek <70...@users.noreply.github.com>
AuthorDate: Mon Jun 23 21:26:32 2025 +0500
Fix PubsubIOLT (#35372)
* Fix PubsubIOLT
* Fix formatting
---
.../src/test/java/org/apache/beam/it/gcp/pubsub/PubsubIOLT.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/pubsub/PubsubIOLT.java b/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/pubsub/PubsubIOLT.java
index 77f32a94103..477c79dd3bc 100644
--- a/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/pubsub/PubsubIOLT.java
+++ b/it/google-cloud-platform/src/test/java/org/apache/beam/it/gcp/pubsub/PubsubIOLT.java
@@ -74,6 +74,7 @@ import org.junit.Test;
*/
public class PubsubIOLT extends IOLoadTestBase {
+ private static final double TOLERANCE_FRACTION = 0.005;
private static final int NUMBER_OF_BUNDLES_FOR_LOCAL = 10;
private static final int NUMBER_OF_BUNDLES_FOR_MEDIUM_AND_LARGE = 20;
private static final String READ_ELEMENT_METRIC_NAME = "read_count";
@@ -239,10 +240,12 @@ public class PubsubIOLT extends IOLoadTestBase {
readLaunchInfo.jobId(),
getBeamMetricsName(PipelineMetricsType.COUNTER, READ_ELEMENT_METRIC_NAME));
- // Assert that actual data equals or greater than expected data number since there might be
+ // Assert that actual data is within tolerance of expected data number since there might be
// duplicates when testing big amount of data
long expectedDataNum = configuration.numRecords - configuration.forceNumInitialBundles;
- assertTrue(numRecords >= expectedDataNum);
+ long allowedTolerance = (long) (configuration.numRecords * TOLERANCE_FRACTION);
+ double delta = Math.abs(numRecords - expectedDataNum);
+ assertTrue(delta <= allowedTolerance);
// export metrics
MetricsConfiguration writeMetricsConfig =
@@ -305,6 +308,7 @@ public class PubsubIOLT extends IOLoadTestBase {
.addParameter("runner", configuration.runner)
.addParameter("streaming", "true")
.addParameter("numWorkers", String.valueOf(configuration.numWorkers))
+ .addParameter("experiments", "use_runner_v2")
.build();
return pipelineLauncher.launch(project, region, writeOptions);
@@ -339,6 +343,7 @@ public class PubsubIOLT extends IOLoadTestBase {
.addParameter("runner", configuration.runner)
.addParameter("streaming", "true")
.addParameter("numWorkers", String.valueOf(configuration.numWorkers))
+ .addParameter("experiments", "use_runner_v2")
.build();
return pipelineLauncher.launch(project, region, readOptions);