Skip to content

TINKERPOP-1365 Refactored use of Random in tests#881

Merged
asfgit merged 1 commit into
tp32from
TINKERPOP-1365
Jul 17, 2018
Merged

TINKERPOP-1365 Refactored use of Random in tests#881
asfgit merged 1 commit into
tp32from
TINKERPOP-1365

Conversation

@spmallette
Copy link
Copy Markdown
Contributor

@spmallette spmallette commented Jun 21, 2018

https://issues.apache.org/jira/browse/TINKERPOP-1365

Each test suite now uses the same instance of Random which prints the seed given to it so that if there is a failure, we can easily try to recreate it by taking the seed and passing it in as a system property with -DtestSeed. The output logs as:

[INFO] org.apache.tinkerpop.gremlin.TestHelper - *** THE RANDOM TEST SEED IS 1529585621517 ***

I didn't replace all of the old use of Random - there were a couple places where I felt like a true Random was still necessary and just left it alone despite the horror it might cause. Going forward we'll want to use the TestHelper.RANDOM whenever possible (or, better, just not use a Random at all).

All tests pass with docker/build.sh -t -n -i

VOTE +1

@spmallette spmallette changed the base branch from master to tp32 June 21, 2018 14:23
static {
final long seed = Long.parseLong(System.getProperty("testSeed", String.valueOf(System.currentTimeMillis())));
logger.info("*** THE RANDOM TEST SEED IS {} ***", seed);
RANDOM = new Random();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be RANDOM = new Random(seed);.

Copy link
Copy Markdown
Contributor Author

@spmallette spmallette Jun 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow - the whole point of the PR and i didn't even do it right 😞 :rage4:

fixed now.

Each test suite now uses the same instance of Random which prints the seed given to it so that if there is a failure, we can easily try to recreate it by taking the seed and passing it in as a system property with -DtestSeed.
@asfgit asfgit merged commit 38f4036 into tp32 Jul 17, 2018
@asfgit asfgit deleted the TINKERPOP-1365 branch October 24, 2018 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants