Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
squito committed Apr 13, 2015
1 parent d493b38 commit cf86175
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class HistoryServerSuite extends FunSuite with BeforeAndAfter with Matchers with
// TODO multi-attempt stages
)

//run a bunch of characterization tests -- just verify the behavior is the same as what is saved
// run a bunch of characterization tests -- just verify the behavior is the same as what is saved
// in the test resource folder
cases.foreach { case (name, path) =>
test(name) {
Expand All @@ -114,8 +114,9 @@ class HistoryServerSuite extends FunSuite with BeforeAndAfter with Matchers with
jsonOpt should be ('defined)
errOpt should be (None)
val json = jsonOpt.get
val exp = IOUtils.toString(new FileInputStream(new File(expRoot, path + "/json_expectation")))
//compare the ASTs so formatting differences don't cause failures
val exp = IOUtils.toString(new FileInputStream(
new File(expRoot, path + "/json_expectation")))
// compare the ASTs so formatting differences don't cause failures
import org.json4s._
import org.json4s.jackson.JsonMethods._
val jsonAst = parse(json)
Expand Down Expand Up @@ -261,9 +262,12 @@ object HistoryServerSuite {

def getUrl(path: URL): String = {
val (code, resultOpt, error) = getContentAndCode(path)
if (code == 200)
if (code == 200) {
resultOpt.get
else throw new RuntimeException("got code: " + code + " when getting " + path + " w/ error: " + error)
} else {
throw new RuntimeException(
"got code: " + code + " when getting " + path + " w/ error: " + error)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import org.scalatest.{Matchers, FunSuite}
class SimpleDateParamTest extends FunSuite with Matchers {

test("date parsing") {
new SimpleDateParam("2015-02-20T23:21:17.190GMT").timestamp should be (1424474477190l)
new SimpleDateParam("2015-02-20T17:21:17.190CST").timestamp should be (1424474477190l)
new SimpleDateParam("2015-02-20").timestamp should be (1424390400000L) //GMT
new SimpleDateParam("2015-02-20T23:21:17.190GMT").timestamp should be (1424474477190L)
new SimpleDateParam("2015-02-20T17:21:17.190CST").timestamp should be (1424474477190L)
new SimpleDateParam("2015-02-20").timestamp should be (1424390400000L) // GMT
}

}
11 changes: 7 additions & 4 deletions core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before

val updatedStorageJson = getJson(ui, "storage/rdd")
updatedStorageJson.children.length should be (1)
(updatedStorageJson \ "storageLevel").extract[String] should be (StorageLevels.MEMORY_ONLY.description)
(updatedStorageJson \ "storageLevel").extract[String] should be (
StorageLevels.MEMORY_ONLY.description)
val updatedRddJson = getJson(ui, "storage/rdd/0")
(updatedRddJson \ "storageLevel").extract[String] should be (StorageLevels.MEMORY_ONLY.description)
(updatedRddJson \ "storageLevel").extract[String] should be (
StorageLevels.MEMORY_ONLY.description)
}
}

Expand Down Expand Up @@ -431,7 +433,7 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before
assert(sc.ui.isDefined)

withSpark(sc) { sc =>
//run a few jobs & stages ...
// run a few jobs & stages ...
(0 until 5).foreach { idx =>
// NOTE: if we reverse the order, things don't really behave nicely
// we lose the stage for a job we keep, and then the job doesn't know
Expand Down Expand Up @@ -544,7 +546,8 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before

test("live UI json application list") {
withSpark(newSparkContext()) { sc =>
val appListRawJson = HistoryServerSuite.getUrl(new URL(sc.ui.get.appUIAddress + "/json/v1/applications"))
val appListRawJson = HistoryServerSuite.getUrl(new URL(
sc.ui.get.appUIAddress + "/json/v1/applications"))
val appListJsonAst = JsonMethods.parse(appListRawJson)
appListJsonAst.children.length should be (1)
(appListJsonAst \ "completed").extract[Boolean] should be (false)
Expand Down

0 comments on commit cf86175

Please sign in to comment.