You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2018/11/08 19:28:21 UTC

kudu git commit: gradle: expose testRandomSeed property

Repository: kudu
Updated Branches:
  refs/heads/master f1eac9c5a -> 2fbdef668


gradle: expose testRandomSeed property

In order to read a system property in tests, it isn't enough to add a
System.getProperty() call to the test; we need to expose the property in
gradle so that it's properly passed through to the test. With this patch,
testRandomSeed can be set using either -D or -P.

Note that even with testRandomSeed overridden, the PRNG didn't produce
deterministic results in TestKuduBackup.testRandomBackupAndRestore, but
perhaps that's a quirk of Scala's Random class.

Change-Id: I4873d27998f770a45dd9cc85f84ec8c146261b3d
Reviewed-on: http://gerrit.cloudera.org:8080/11908
Reviewed-by: Grant Henke <gr...@apache.org>
Tested-by: Adar Dembo <ad...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/2fbdef66
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/2fbdef66
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/2fbdef66

Branch: refs/heads/master
Commit: 2fbdef6688ab76c508d360a04cf6f75890242e6f
Parents: f1eac9c
Author: Adar Dembo <ad...@cloudera.com>
Authored: Thu Nov 8 00:40:27 2018 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Thu Nov 8 19:28:10 2018 +0000

----------------------------------------------------------------------
 java/gradle/tests.gradle | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/2fbdef66/java/gradle/tests.gradle
----------------------------------------------------------------------
diff --git a/java/gradle/tests.gradle b/java/gradle/tests.gradle
index 0da59ec..c5110fb 100644
--- a/java/gradle/tests.gradle
+++ b/java/gradle/tests.gradle
@@ -63,6 +63,13 @@ tasks.withType(Test) {
   // Set kuduBinDir to the binaries to use with the MiniKuduCluster.
   systemProperty "kuduBinDir", propertyWithDefault("kuduBinDir", "$project.rootDir/../build/latest/bin")
 
+  // Set testRandomSeed to override the seed for the PRNG exposed in
+  // RandomUtils.java and used by various tests. This is useful when trying to
+  // reproduce a test failure for a test that uses the PRNG to generate state.
+  if (propertyExists("testRandomSeed")) {
+    systemProperty "testRandomSeed", propertyWithDefault("testRandomSeed", null)
+  }
+
   // Don't fail the build if a --tests filter doesn't match any tests.
   // This is useful for filtering tests from the top of the project where some
   // subprojects won't match the filter. Without this, those subprojects would fail.