Skip to content

Commit

Permalink
[SPARK-29230][CORE][TEST] Fix NPE in ProcfsMetricsGetterSuite
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

When I use `ProcfsMetricsGetterSuite for` testing, always throw out `java.lang.NullPointerException`. I think there is a problem with locating `new ProcfsMetricsGetter`, which will lead to `SparkEnv` not being initialized in time. This leads to `java.lang.NullPointerException` when the method is executed.

### Why are the changes needed?
For test.

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

Local testing

Closes #25918 from sev7e0/dev_0924.

Authored-by: sev7e0 <sev7e0@gmail.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
  • Loading branch information
sev7e0 authored and dongjoon-hyun committed Sep 24, 2019
1 parent d75588c commit e650f8f
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -22,9 +22,9 @@ import org.apache.spark.SparkFunSuite

class ProcfsMetricsGetterSuite extends SparkFunSuite {

val p = new ProcfsMetricsGetter(getTestResourcePath("ProcfsMetrics"))

test("testGetProcessInfo") {
val p = new ProcfsMetricsGetter(getTestResourcePath("ProcfsMetrics"))
var r = ProcfsMetrics(0, 0, 0, 0, 0, 0)
r = p.addProcfsMetricsFromOneProcess(r, 26109)
assert(r.jvmVmemTotal == 4769947648L)
Expand Down

0 comments on commit e650f8f

Please sign in to comment.