From 5cce6e9affc22a492a8e6bc5cf3bb7d200bfb41a Mon Sep 17 00:00:00 2001 From: Dongjoon Hyun Date: Wed, 29 Jan 2025 10:26:35 -0800 Subject: [PATCH] [SPARK-51033][CORE][TESTS] Fix `CryptoStreamUtilsSuite` to use `sameElements` for array comparison ### What changes were proposed in this pull request? This PR aims to fix `CryptoStreamUtilsSuite` to use `sameElements` for array comparison. ### Why are the changes needed? Since the existing assertion is invalid due to `String != Array[Byte]` comparison, it causes a compilation error from Scala 2.13.16. https://github.com/apache/spark/blob/6bbfa2dad8c70b94ca52eb7cddde5ec68efbe0b1/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala#L115 - #49478 ### Does this PR introduce _any_ user-facing change? No, this is a test-only fix. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49727 from dongjoon-hyun/SPARK-51033. Authored-by: Dongjoon Hyun Signed-off-by: Dongjoon Hyun --- .../org/apache/spark/security/CryptoStreamUtilsSuite.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala b/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala index 27a53e8205201..e3171116a3e14 100644 --- a/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala +++ b/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala @@ -112,7 +112,7 @@ class CryptoStreamUtilsSuite extends SparkFunSuite { bytes.toByteArray() }.collect()(0) - assert(content != encrypted) + assert(!content.getBytes(UTF_8).sameElements(encrypted)) val in = CryptoStreamUtils.createCryptoInputStream(new ByteArrayInputStream(encrypted), sc.conf, SparkEnv.get.securityManager.getIOEncryptionKey().get)