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:27:17 UTC

(spark) branch branch-3.5 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-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


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

commit 1f8147537df5040ec934216b2cbaf9f4a6943fcd
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 c3d96e7c42af..f4a754a7a7d5 100644
--- a/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala
+++ b/core/src/test/scala/org/apache/spark/security/CryptoStreamUtilsSuite.scala
@@ -115,7 +115,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