From 1857a1ce5164bd78fb4e114ebfff3635001a35dd Mon Sep 17 00:00:00 2001 From: Felix Cheung Date: Sun, 3 Sep 2017 00:18:29 -0700 Subject: [PATCH 1/2] set seed --- R/pkg/tests/fulltests/test_sparkSQL.R | 2 +- R/pkg/tests/run-all.R | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/R/pkg/tests/fulltests/test_sparkSQL.R b/R/pkg/tests/fulltests/test_sparkSQL.R index d477fc6a4256c..7233c59e409bb 100644 --- a/R/pkg/tests/fulltests/test_sparkSQL.R +++ b/R/pkg/tests/fulltests/test_sparkSQL.R @@ -1118,7 +1118,7 @@ test_that("sample on a DataFrame", { # nolint start # Test base::sample is working - #expect_equal(length(sample(1:12)), 12) + expect_equal(length(sample(1:12)), 12) # nolint end }) diff --git a/R/pkg/tests/run-all.R b/R/pkg/tests/run-all.R index 0aefd8006caa4..a1834a220261d 100644 --- a/R/pkg/tests/run-all.R +++ b/R/pkg/tests/run-all.R @@ -43,6 +43,8 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { test_package("SparkR") if (identical(Sys.getenv("NOT_CRAN"), "true")) { + # set random seed for predictable results. mostly for base's sample() in tree and classification + set.seed(42) # for testthat 1.0.2 later, change reporter from "summary" to default_reporter() testthat:::run_tests("SparkR", file.path(sparkRDir, "pkg", "tests", "fulltests"), From 5d156be92fd3cfe8af30094fd759909ce5455d8f Mon Sep 17 00:00:00 2001 From: Felix Cheung Date: Sun, 3 Sep 2017 11:48:03 -0700 Subject: [PATCH 2/2] base::sample is masked --- R/pkg/tests/fulltests/test_sparkSQL.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/pkg/tests/fulltests/test_sparkSQL.R b/R/pkg/tests/fulltests/test_sparkSQL.R index 7233c59e409bb..d477fc6a4256c 100644 --- a/R/pkg/tests/fulltests/test_sparkSQL.R +++ b/R/pkg/tests/fulltests/test_sparkSQL.R @@ -1118,7 +1118,7 @@ test_that("sample on a DataFrame", { # nolint start # Test base::sample is working - expect_equal(length(sample(1:12)), 12) + #expect_equal(length(sample(1:12)), 12) # nolint end })