Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
f2263350
Commit
f2263350
authored
11 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Added a local-cluster mode test to ReplSuite
parent
6c8d1b2c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
repl/src/test/scala/spark/repl/ReplSuite.scala
+26
-5
26 additions, 5 deletions
repl/src/test/scala/spark/repl/ReplSuite.scala
with
26 additions
and
5 deletions
repl/src/test/scala/spark/repl/ReplSuite.scala
+
26
−
5
View file @
f2263350
...
...
@@ -35,17 +35,17 @@ class ReplSuite extends FunSuite {
System
.
clearProperty
(
"spark.hostPort"
)
return
out
.
toString
}
def
assertContains
(
message
:
String
,
output
:
String
)
{
assert
(
output
contains
message
,
"Interpreter output did not contain '"
+
message
+
"':\n"
+
output
)
}
def
assertDoesNotContain
(
message
:
String
,
output
:
String
)
{
assert
(!(
output
contains
message
),
"Interpreter output contained '"
+
message
+
"':\n"
+
output
)
}
test
(
"simple foreach with accumulator"
)
{
val
output
=
runInterpreter
(
"local"
,
"""
val accum = sc.accumulator(0)
...
...
@@ -56,7 +56,7 @@ class ReplSuite extends FunSuite {
assertDoesNotContain
(
"Exception"
,
output
)
assertContains
(
"res1: Int = 55"
,
output
)
}
test
(
"external vars"
)
{
val
output
=
runInterpreter
(
"local"
,
"""
var v = 7
...
...
@@ -105,7 +105,7 @@ class ReplSuite extends FunSuite {
assertContains
(
"res0: Int = 70"
,
output
)
assertContains
(
"res1: Int = 100"
,
output
)
}
test
(
"broadcast vars"
)
{
// Test that the value that a broadcast var had when it was created is used,
// even if that variable is then modified in the driver program
...
...
@@ -143,6 +143,27 @@ class ReplSuite extends FunSuite {
assertContains
(
"res2: Long = 3"
,
output
)
}
test
(
"local-cluster mode"
)
{
val
output
=
runInterpreter
(
"local-cluster[1,1,512]"
,
"""
var v = 7
def getV() = v
sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_)
v = 10
sc.parallelize(1 to 10).map(x => getV()).collect.reduceLeft(_+_)
var array = new Array[Int](5)
val broadcastArray = sc.broadcast(array)
sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect
array(0) = 5
sc.parallelize(0 to 4).map(x => broadcastArray.value(x)).collect
"""
)
assertDoesNotContain
(
"error:"
,
output
)
assertDoesNotContain
(
"Exception"
,
output
)
assertContains
(
"res0: Int = 70"
,
output
)
assertContains
(
"res1: Int = 100"
,
output
)
assertContains
(
"res2: Array[Int] = Array(0, 0, 0, 0, 0)"
,
output
)
assertContains
(
"res4: Array[Int] = Array(0, 0, 0, 0, 0)"
,
output
)
}
if
(
System
.
getenv
(
"MESOS_NATIVE_LIBRARY"
)
!=
null
)
{
test
(
"running on Mesos"
)
{
val
output
=
runInterpreter
(
"localquiet"
,
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment