aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests
diff options
context:
space:
mode:
authorfelixcheung <felixcheung_m@hotmail.com>2015-12-03 13:25:20 -0800
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-12-03 13:25:20 -0800
commit2213441e5e0fba01e05826257604aa427cdf2598 (patch)
treef9628f8232f8f65c15e0774b94cfdc4ca0c3a127 /R/pkg/inst/tests
parenta02d47277379e1e82d0ee41b2205434f9ffbc3e5 (diff)
downloadspark-2213441e5e0fba01e05826257604aa427cdf2598.tar.gz
spark-2213441e5e0fba01e05826257604aa427cdf2598.tar.bz2
spark-2213441e5e0fba01e05826257604aa427cdf2598.zip
[SPARK-12019][SPARKR] Support character vector for sparkR.init(), check param and fix doc
and add tests. Spark submit expects comma-separated list Author: felixcheung <felixcheung_m@hotmail.com> Closes #10034 from felixcheung/sparkrinitdoc.
Diffstat (limited to 'R/pkg/inst/tests')
-rw-r--r--R/pkg/inst/tests/test_client.R9
-rw-r--r--R/pkg/inst/tests/test_context.R20
2 files changed, 29 insertions, 0 deletions
diff --git a/R/pkg/inst/tests/test_client.R b/R/pkg/inst/tests/test_client.R
index 8a20991f89..a0664f32f3 100644
--- a/R/pkg/inst/tests/test_client.R
+++ b/R/pkg/inst/tests/test_client.R
@@ -34,3 +34,12 @@ test_that("no package specified doesn't add packages flag", {
test_that("multiple packages don't produce a warning", {
expect_that(generateSparkSubmitArgs("", "", "", "", c("A", "B")), not(gives_warning()))
})
+
+test_that("sparkJars sparkPackages as character vectors", {
+ args <- generateSparkSubmitArgs("", "", c("one.jar", "two.jar", "three.jar"), "",
+ c("com.databricks:spark-avro_2.10:2.0.1",
+ "com.databricks:spark-csv_2.10:1.3.0"))
+ expect_match(args, "--jars one.jar,two.jar,three.jar")
+ expect_match(args,
+ "--packages com.databricks:spark-avro_2.10:2.0.1,com.databricks:spark-csv_2.10:1.3.0")
+})
diff --git a/R/pkg/inst/tests/test_context.R b/R/pkg/inst/tests/test_context.R
index 80c1b89a4c..1707e314be 100644
--- a/R/pkg/inst/tests/test_context.R
+++ b/R/pkg/inst/tests/test_context.R
@@ -92,3 +92,23 @@ test_that("getClientModeSparkSubmitOpts() returns spark-submit args from whiteli
" --driver-memory 4g sparkr-shell2"))
# nolint end
})
+
+test_that("sparkJars sparkPackages as comma-separated strings", {
+ expect_warning(processSparkJars(" a, b "))
+ jars <- suppressWarnings(processSparkJars(" a, b "))
+ expect_equal(jars, c("a", "b"))
+
+ jars <- suppressWarnings(processSparkJars(" abc ,, def "))
+ expect_equal(jars, c("abc", "def"))
+
+ jars <- suppressWarnings(processSparkJars(c(" abc ,, def ", "", "xyz", " ", "a,b")))
+ expect_equal(jars, c("abc", "def", "xyz", "a", "b"))
+
+ p <- processSparkPackages(c("ghi", "lmn"))
+ expect_equal(p, c("ghi", "lmn"))
+
+ # check normalizePath
+ f <- dir()[[1]]
+ expect_that(processSparkJars(f), not(gives_warning()))
+ expect_match(processSparkJars(f), f)
+})