Oh, one thing though, don't use System.setProperty in tests (especially because these are not cleared!). Create a SparkConf and pass it to your SparkContext.