You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2025/01/29 18:26:57 UTC

(spark) branch branch-4.0 updated: [SPARK-51033][CORE][TESTS] Fix `CryptoStreamUtilsSuite` to use `sameElements` for array comparison

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 67641a8ab4a1 [SPARK-51033][CORE][TESTS] Fix `CryptoStreamUtilsSuite` to use `sameElements` for array comparison
67641a8ab4a1 is described below

commit 67641a8ab4a14dc741b2b1f0489cb7a9fd02a870
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Wed Jan 29 10:26:35 2025 -0800

    [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 <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
    (cherry picked from commit 5cce6e9affc22a492a8e6bc5cf3bb7d200bfb41a)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../test/scala/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 27a53e820520..e3171116a3e1 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)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org