Skip to content

Commit 72b4de4

Browse files
committed
[SPARK-51749] Add MacOS integration test with Apache Spark 4.0.0 RC3
1 parent 2c91276 commit 72b4de4

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

.github/workflows/build_and_test.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Build
5656
run: swift build -v
5757

58-
integration-test:
58+
integration-test-linux:
5959
runs-on: ubuntu-latest
6060
services:
6161
spark:
@@ -72,3 +72,19 @@ jobs:
7272
swift-version: "6"
7373
- name: Test
7474
run: swift test --no-parallel
75+
76+
integration-test-mac:
77+
runs-on: macos-15
78+
steps:
79+
- uses: actions/checkout@v4
80+
- uses: swift-actions/[email protected]
81+
with:
82+
swift-version: "6"
83+
- name: Test
84+
run: |
85+
curl -LO https://dist.apache.org/repos/dist/dev/spark/v4.0.0-rc3-bin/spark-4.0.0-bin-hadoop3.tgz
86+
tar xvfz spark-4.0.0-bin-hadoop3.tgz
87+
cd spark-4.0.0-bin-hadoop3/sbin
88+
./start-connect-server.sh
89+
cd ../..
90+
swift test --no-parallel

Tests/SparkConnectTests/SQLTests.swift

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,25 @@ struct SQLTests {
3030

3131
let regexID = /#\d+L?/
3232
let regexPlanId = /plan_id=\d+/
33+
let regexLocation = /file:[a-zA-Z0-9\.\-\/\\]+/
34+
let regexOwner = /(runner|185)/
35+
36+
private func cleanUp(_ str: String) -> String {
37+
return removeOwner(removeID(removeLocation(str)))
38+
}
3339

3440
private func removeID(_ str: String) -> String {
3541
return str.replacing(regexPlanId, with: "plan_id=").replacing(regexID, with: "#")
3642
}
3743

44+
private func removeLocation(_ str: String) -> String {
45+
return str.replacing(regexLocation, with: "*")
46+
}
47+
48+
private func removeOwner(_ str: String) -> String {
49+
return str.replacing(regexOwner, with: "*")
50+
}
51+
3852
@Test
3953
func testRemoveID() {
4054
#expect(removeID("123") == "123")
@@ -44,6 +58,17 @@ struct SQLTests {
4458
#expect(removeID("plan_id=123") == "plan_id=")
4559
}
4660

61+
@Test
62+
func removeLocation() {
63+
#expect(removeLocation("file:/abc") == "*")
64+
}
65+
66+
@Test
67+
func removeOwner() {
68+
#expect(removeOwner("runner") == "*")
69+
#expect(removeOwner("185") == "*")
70+
}
71+
4772
#if !os(Linux)
4873
@Test
4974
func runAll() async throws {
@@ -54,8 +79,8 @@ struct SQLTests {
5479

5580
let sql = try String(contentsOf: URL(fileURLWithPath: "\(path)/\(name)"), encoding: .utf8)
5681
let jsonData = try encoder.encode(try await spark.sql(sql).collect())
57-
let answer = removeID(String(data: jsonData, encoding: .utf8)!)
58-
let expected = removeID(try String(contentsOf: URL(fileURLWithPath: "\(path)/\(name).json"), encoding: .utf8))
82+
let answer = cleanUp(String(data: jsonData, encoding: .utf8)!)
83+
let expected = cleanUp(try String(contentsOf: URL(fileURLWithPath: "\(path)/\(name).json"), encoding: .utf8))
5984
#expect(answer == expected.trimmingCharacters(in: .whitespacesAndNewlines))
6085
}
6186
await spark.stop()

0 commit comments

Comments
 (0)