super small nit: I meant something more like `if (!hasHadoopEnv && !testing)` here, since the variable `hasHadoopEnv` should really not depend on whether we're testing Spark or not.