From 89301818334185fd4f9881e5c0b123be94018e76 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Wed, 24 Feb 2016 07:05:20 -0800 Subject: [SPARK-13472] [SPARKR] Fix unstable Kmeans test in R JIRA: https://issues.apache.org/jira/browse/SPARK-13472 ## What changes were proposed in this pull request? One Kmeans test in R is unstable and sometimes fails. We should fix it. ## How was this patch tested? Unit test is modified in this PR. Author: Liang-Chi Hsieh Closes #11345 from viirya/fix-kmeans-r-test and squashes the following commits: f959f61 [Liang-Chi Hsieh] Sort resulted clusters. --- R/pkg/inst/tests/testthat/test_mllib.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'R') diff --git a/R/pkg/inst/tests/testthat/test_mllib.R b/R/pkg/inst/tests/testthat/test_mllib.R index 595512e0e0..af84a0abcf 100644 --- a/R/pkg/inst/tests/testthat/test_mllib.R +++ b/R/pkg/inst/tests/testthat/test_mllib.R @@ -130,7 +130,7 @@ test_that("kmeans", { # Test stats::kmeans is working statsModel <- kmeans(x = newIris, centers = 2) - expect_equal(unique(statsModel$cluster), c(1, 2)) + expect_equal(sort(unique(statsModel$cluster)), c(1, 2)) # Test fitted works on KMeans fitted.model <- fitted(model) -- cgit v1.2.3