Skip to content

Commit

Permalink
[SPARK-51033][CORE][TESTS] Fix CryptoStreamUtilsSuite to use `sameE…
Browse files Browse the repository at this point in the history
…lements` 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 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 5cce6e9)
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun committed Jan 29, 2025
1 parent 2004df7 commit 67641a8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 67641a8

Please sign in to comment.