beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] branch master updated: [BEAM-10471] Change assertion method to improve expressiveness and increase error margin on non deterministic size test to avoid flakiness
Date Fri, 17 Jul 2020 07:46:06 GMT
This is an automated email from the ASF dual-hosted git repository.

echauchot 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 2003985  [BEAM-10471] Change assertion method to improve expressiveness and increase
error margin on non deterministic size test to avoid flakiness
     new bedae33  Merge pull request #12276 from echauchot/BEAM-10471-cassandraIO-size-flakiness
2003985 is described below

commit 20039857d808b4a94e7990e76b7092350d249a91
Author: Etienne Chauchot <echauchot@apache.org>
AuthorDate: Thu Jul 16 12:18:31 2020 +0200

    [BEAM-10471] Change assertion method to improve expressiveness and increase error margin
on non deterministic size test to avoid flakiness
---
 .../java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java
b/sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java
index 0f91448..fda20e8 100644
--- a/sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java
+++ b/sdks/java/io/cassandra/src/test/java/org/apache/beam/sdk/io/cassandra/CassandraIOTest.java
@@ -23,6 +23,7 @@ import static org.apache.beam.sdk.io.cassandra.CassandraIO.CassandraSource.getEs
 import static org.apache.beam.sdk.io.cassandra.CassandraIO.CassandraSource.getRingFraction;
 import static org.apache.beam.sdk.io.cassandra.CassandraIO.CassandraSource.isMurmur3Partitioner;
 import static org.apache.beam.sdk.testing.SourceTestUtils.readFromSource;
+import static org.hamcrest.Matchers.closeTo;
 import static org.hamcrest.Matchers.lessThan;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -287,8 +288,12 @@ public class CassandraIOTest implements Serializable {
             .withTable(CASSANDRA_TABLE);
     CassandraIO.CassandraSource<Scientist> source = new CassandraIO.CassandraSource<>(read,
null);
     long estimatedSizeBytes = source.getEstimatedSizeBytes(pipelineOptions);
-    // the size is non determanistic in Cassandra backend
-    assertTrue((estimatedSizeBytes >= 12960L * 0.9f) && (estimatedSizeBytes <=
12960L * 1.1f));
+    // the size is non determanistic in Cassandra backend: checks that estimatedSizeBytes
>= 12960L
+    // -20%  && estimatedSizeBytes <= 12960L +20%
+    assertThat(
+        "wrong estimated size in " + CASSANDRA_KEYSPACE + "/" + CASSANDRA_TABLE,
+        (double) estimatedSizeBytes,
+        closeTo(12960.0D, 2592.0D));
   }
 
   @Test


Mime
View raw message