-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST] randomly introduced a client node within test cluster #5949
Conversation
The default number of clients nodes is 1, applied to all cluster scopes (global, suite and test). Can be disabled though through the newly added `@ClusterScope#numClientNodes`. In our tests we currently refer to nodes in a generic way. All the tests that either stop or start nodes rely on the fact that those nodes hold data though. Made that clearer as that becomes more important when introducing other types of nodes within the test cluster. Reflected this by adapting and renaming the following methods: - ensureAtLeastNumNodes to ensureAtLeastNumDataNodes - ensureAtMostNumNodes to ensureAtMostNumDataNodes - stopRandomNode to stopRandomDataNode Added facilities to be able to deal with data nodes specifically, like for instance retrieve a client to a data node, or retrieve an instance of a class through guice only from data nodes. Renamed also `dataNodes` method to `numDataNodes`. Adapted existing tests to successfully run although there's a node client around. Fixed _cat/allocation REST tests to make disk.total, disk.avail and disk.percent optional as client nodes won't return that info.
this.numSharedDataNodes = minNumDataNodes; | ||
} else { | ||
this.numSharedDataNodes = minNumDataNodes + random.nextInt(maxNumDataNodes - minNumDataNodes); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numSharedDataNodes = RandomInts.randomIntBetween(minNumDataNodes, maxNumDataNodes)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point :) not that I changed this line in this PR (just moved it) but it's worth doing what you suggest!
…aNodes, minNumDataNodes and maxNumDataNodes
Hey @jpountz I added a couple of commits, the first one addresses your comments, the second one completes the renaming work, since I found some leftover |
this.numSharedDataNodes = minNumDataNodes; | ||
} else { | ||
this.numSharedDataNodes = RandomInts.randomIntBetween(random, minNumDataNodes, maxNumDataNodes); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then, I think we don't need the if
statement anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one!
LGTM |
…mClientNodes to -1, meaning that it will be randomized between 0 and 1 unless specified
The default number of clients nodes is randomized between 0 and 1, applied to all cluster scopes (global, suite and test). Can be changed through the newly added `@ClusterScope#numClientNodes`. In our tests we currently refer to nodes in a generic way. All the tests that either stop or start nodes rely on the fact that those nodes hold data though. Made that clearer as that becomes more important when introducing other types of nodes within the test cluster. Reflected this by adapting and renaming the following methods in `TestCluster`: - ensureAtLeastNumNodes to ensureAtLeastNumDataNodes - ensureAtMostNumNodes to ensureAtMostNumDataNodes - stopRandomNode to stopRandomDataNode and the following ones in `ElasticsearchIntegrationTest`: - allowNodes to allowDataNodes - dataNodes to numDataNodes. - @ClusterScope#numNodes to numDataNodes - @ClusterScope#minNumNodes to minNumDataNodes - @ClusterScope#maxNumNodes to maxNumDataNodes Added facilities to be able to deal with data nodes specifically, like for instance retrieve a client to a data node, or retrieve an instance of a class through guice only from data nodes. Adapted existing tests to successfully run although there's a node client around. Fixed _cat/allocation REST tests to make disk.total, disk.avail and disk.percent optional as client nodes won't return that info. Closes #5949
The default number of clients nodes is 1, applied to all cluster scopes (global, suite and test). Can be changed though through the newly added
@ClusterScope#numClientNodes
.In our tests we currently refer to nodes in a generic way. All the tests that either stop or start nodes rely on the fact that those nodes hold data though. Made that clearer as that becomes more important when introducing other types of nodes within the test cluster. Reflected this by adapting and renaming the following methods in
TestCluster
:ensureAtLeastNumNodes
toensureAtLeastNumDataNodes
ensureAtMostNumNodes
toensureAtMostNumDataNodes
stopRandomNode
tostopRandomDataNode
and the following ones in
ElasticsearchIntegrationTest
:dataNodes
tonumDataNodes
.@ClusterScope#numNodes
tonumDataNodes
@ClusterScope#minNumNodes
tominNumDataNodes
@ClusterScope#maxNumNodes
tomaxNumDataNodes
Added facilities to be able to deal with data nodes specifically, like for instance retrieve a client to a data node, or retrieve an instance of a class through guice only from data nodes.
Adapted existing tests to successfully run although there's a node client around.
Fixed _cat/allocation REST tests to make disk.total, disk.avail and disk.percent optional as client nodes won't return that info.