2015-06-24 14:55:20 -04:00
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
context("functions in client.R")
|
|
|
|
|
|
|
|
test_that("adding spark-testing-base as a package works", {
|
2017-05-04 00:40:18 -04:00
|
|
|
skip_on_cran()
|
|
|
|
|
2015-06-24 14:55:20 -04:00
|
|
|
args <- generateSparkSubmitArgs("", "", "", "",
|
|
|
|
"holdenk:spark-testing-base:1.3.0_0.0.5")
|
|
|
|
expect_equal(gsub("[[:space:]]", "", args),
|
|
|
|
gsub("[[:space:]]", "",
|
|
|
|
"--packages holdenk:spark-testing-base:1.3.0_0.0.5"))
|
|
|
|
})
|
|
|
|
|
|
|
|
test_that("no package specified doesn't add packages flag", {
|
2017-05-04 00:40:18 -04:00
|
|
|
skip_on_cran()
|
|
|
|
|
2015-06-24 14:55:20 -04:00
|
|
|
args <- generateSparkSubmitArgs("", "", "", "", "")
|
|
|
|
expect_equal(gsub("[[:space:]]", "", args),
|
|
|
|
"")
|
|
|
|
})
|
2015-07-28 13:45:19 -04:00
|
|
|
|
|
|
|
test_that("multiple packages don't produce a warning", {
|
2017-05-04 00:40:18 -04:00
|
|
|
skip_on_cran()
|
|
|
|
|
2016-05-03 12:29:49 -04:00
|
|
|
expect_warning(generateSparkSubmitArgs("", "", "", "", c("A", "B")), NA)
|
2015-07-28 13:45:19 -04:00
|
|
|
})
|
2015-12-03 16:25:20 -05:00
|
|
|
|
|
|
|
test_that("sparkJars sparkPackages as character vectors", {
|
2017-05-04 00:40:18 -04:00
|
|
|
skip_on_cran()
|
|
|
|
|
2015-12-03 16:25:20 -05:00
|
|
|
args <- generateSparkSubmitArgs("", "", c("one.jar", "two.jar", "three.jar"), "",
|
2016-05-09 12:58:36 -04:00
|
|
|
c("com.databricks:spark-avro_2.10:2.0.1"))
|
2015-12-03 16:25:20 -05:00
|
|
|
expect_match(args, "--jars one.jar,two.jar,three.jar")
|
2016-05-09 12:58:36 -04:00
|
|
|
expect_match(args, "--packages com.databricks:spark-avro_2.10:2.0.1")
|
2015-12-03 16:25:20 -05:00
|
|
|
})
|