From 0968090c1f0f4e928096aa7872b45f038c30033a Mon Sep 17 00:00:00 2001 From: Anton Parkhomenko Date: Sat, 22 Aug 2020 22:53:41 +0300 Subject: [PATCH] Common: fix flaky ThriftLoader test (close #306) --- .../loaders/ThriftLoaderSpec.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/loaders/ThriftLoaderSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/loaders/ThriftLoaderSpec.scala index cc67ccd9c..4a8c0e81c 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/loaders/ThriftLoaderSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/loaders/ThriftLoaderSpec.scala @@ -175,8 +175,14 @@ class ThriftLoaderSpec extends Specification with DataTables with ValidatedMatch canonicalEvent must beValid(expected.some) } - val msg = - "error deserializing raw event: Cannot read. Remote side has closed. Tried to read 1 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)" + val violation1byte: FailureDetails.CPFormatViolationMessage = + FailureDetails.CPFormatViolationMessage.Fallback( + "error deserializing raw event: Cannot read. Remote side has closed. Tried to read 1 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)" + ) + val violation2bytes: FailureDetails.CPFormatViolationMessage = + FailureDetails.CPFormatViolationMessage.Fallback( + "error deserializing raw event: Cannot read. Remote side has closed. Tried to read 2 bytes, but only got 0 bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)" + ) // A bit of fun: the chances of generating a valid Thrift CollectorPayload at random are // so low that we can just use ScalaCheck here @@ -191,7 +197,7 @@ class ThriftLoaderSpec extends Specification with DataTables with ValidatedMatch ), List() ) => - f must_== FailureDetails.CPFormatViolationMessage.Fallback(msg) + (f must beEqualTo(violation1byte)) or (f must beEqualTo(violation2bytes)) } }