From 3e60fc22c47b3bec704c056ff4be28b4cf2c9aeb 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 | 8 +++++--- 1 file changed, 5 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..93191e211 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,10 @@ 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 +193,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)) } }