[SPARK-29230][CORE][TEST] Fix NPE in ProcfsMetricsGetterSuite

### 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>
This commit is contained in:
sev7e0 2019-09-24 14:09:40 -07:00 committed by Dongjoon Hyun
parent d75588c57a
commit e650f8fdba

View file

@ -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)