forked from apache/celeborn
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CELEBORN-1135] Added tests for the RpcEnv and related classes
### What changes were proposed in this pull request? Added test suites for `RpcEnv`, `NettyRpcEnv`, and other related classes. These are copied over from Apache Spark. Some of the UTs in Apache Spark required changes in the source code like [SPARK-39468](https://issues.apache.org/jira/browse/SPARK-39468) which I didn't copy over. ### Why are the changes needed? The change adds unit tests. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Just adds UTs. The source code changes are minimal. Closes apache#2107 from otterc/CELEBORN-1135. Authored-by: Chandni Singh <[email protected]> Signed-off-by: Shuang <[email protected]>
- Loading branch information
Showing
8 changed files
with
1,458 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
common/src/test/scala/org/apache/celeborn/common/rpc/RpcAddressSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.celeborn.common.rpc | ||
|
||
import org.apache.celeborn.CelebornFunSuite | ||
import org.apache.celeborn.common.exception.CelebornException | ||
|
||
class RpcAddressSuite extends CelebornFunSuite { | ||
|
||
test("hostPort") { | ||
val address = RpcAddress("1.2.3.4", 1234) | ||
assert(address.host === "1.2.3.4") | ||
assert(address.port === 1234) | ||
assert(address.hostPort === "1.2.3.4:1234") | ||
} | ||
|
||
test("fromCelebornURL") { | ||
val address = RpcAddress.fromCelebornURL("celeborn://1.2.3.4:1234") | ||
assert(address.host === "1.2.3.4") | ||
assert(address.port === 1234) | ||
} | ||
|
||
test("fromCelebornURL: a typo url") { | ||
val e = intercept[CelebornException] { | ||
RpcAddress.fromCelebornURL("celeborn://1.2. 3.4:1234") | ||
} | ||
assert("Invalid master URL: celeborn://1.2. 3.4:1234" === e.getMessage) | ||
} | ||
|
||
test("fromCelebornURL: invalid scheme") { | ||
val e = intercept[CelebornException] { | ||
RpcAddress.fromCelebornURL("invalid://1.2.3.4:1234") | ||
} | ||
assert("Invalid master URL: invalid://1.2.3.4:1234" === e.getMessage) | ||
} | ||
|
||
test("toCelebornURL") { | ||
val address = RpcAddress("1.2.3.4", 1234) | ||
assert(address.toCelebornURL === "celeborn://1.2.3.4:1234") | ||
} | ||
|
||
} |
Oops, something went wrong.