aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorfelixcheung <felixcheung_m@hotmail.com>2015-11-09 10:26:09 -0800
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-11-09 10:26:09 -0800
commitcd174882a5a211298d6e173fe989d567d08ebc0d (patch)
tree65224fb26b253a6fad8f064a299817a19359d4c1 /R
parent404a28f4edd09cf17361dcbd770e4cafde51bf6d (diff)
downloadspark-cd174882a5a211298d6e173fe989d567d08ebc0d.tar.gz
spark-cd174882a5a211298d6e173fe989d567d08ebc0d.tar.bz2
spark-cd174882a5a211298d6e173fe989d567d08ebc0d.zip
[SPARK-9865][SPARKR] Flaky SparkR test: test_sparkSQL.R: sample on a DataFrame
Make sample test less flaky by setting the seed Tested with ``` repeat { if (count(sample(df, FALSE, 0.1)) == 3) { break } } ``` Author: felixcheung <felixcheung_m@hotmail.com> Closes #9549 from felixcheung/rsample.
Diffstat (limited to 'R')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R4
1 files changed, 2 insertions, 2 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 92cff1fba7..fbdb9a8f1e 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -647,11 +647,11 @@ test_that("sample on a DataFrame", {
sampled <- sample(df, FALSE, 1.0)
expect_equal(nrow(collect(sampled)), count(df))
expect_is(sampled, "DataFrame")
- sampled2 <- sample(df, FALSE, 0.1)
+ sampled2 <- sample(df, FALSE, 0.1, 0) # set seed for predictable result
expect_true(count(sampled2) < 3)
# Also test sample_frac
- sampled3 <- sample_frac(df, FALSE, 0.1)
+ sampled3 <- sample_frac(df, FALSE, 0.1, 0) # set seed for predictable result
expect_true(count(sampled3) < 3)
})