Skip to content

Commit 4baa36b

Browse files
committed
[SPARK-52627] Improve SQLTests to handle userName
1 parent fc90ae5 commit 4baa36b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Tests/SparkConnectTests/Resources/queries/describe_database.sql.answer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
|Namespace Name| default|
66
| Comment| default database|
77
| Location|*|
8-
| Owner| *|
8+
| Owner| spark|
99
+--------------+----------------------------------------+

Tests/SparkConnectTests/SQLTests.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct SQLTests {
3636
let regexOwner = /(runner|185)/
3737

3838
private func cleanUp(_ str: String) -> String {
39-
return removeOwner(removeID(removeLocation(str)))
39+
return removeOwner(removeID(removeLocation(replaceUserName(str))))
4040
}
4141

4242
private func removeID(_ str: String) -> String {
@@ -51,6 +51,14 @@ struct SQLTests {
5151
return str.replacing(regexOwner, with: "*")
5252
}
5353

54+
private func replaceUserName(_ str: String) -> String {
55+
#if os(macOS) || os(Linux)
56+
return str.replacing(ProcessInfo.processInfo.userName, with: "spark")
57+
#else
58+
return str
59+
#endif
60+
}
61+
5462
private func normalize(_ str: String) -> String {
5563
return str.replacing(/[-]+/, with: "-").replacing(/[ ]+/, with: " ")
5664
}

0 commit comments

Comments
 (0)