Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

javanna
Copy link
Member

@javanna javanna commented Apr 26, 2014

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 to ensureAtLeastNumDataNodes
  • ensureAtMostNumNodes to ensureAtMostNumDataNodes
  • stopRandomNode to stopRandomDataNode

and the following ones in ElasticsearchIntegrationTest:

  • 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.

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);
}
Copy link
Contributor

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)?

Copy link
Member Author

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!

@javanna
Copy link
Member Author

javanna commented Apr 28, 2014

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 *nodes methods that need to become *dataNodes.

this.numSharedDataNodes = minNumDataNodes;
} else {
this.numSharedDataNodes = RandomInts.randomIntBetween(random, minNumDataNodes, maxNumDataNodes);
}
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

nice one!

@jpountz
Copy link
Contributor

jpountz commented Apr 28, 2014

LGTM

…mClientNodes to -1, meaning that it will be randomized between 0 and 1 unless specified
@javanna javanna closed this in a414e4f Apr 28, 2014
javanna added a commit that referenced this pull request Apr 28, 2014
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
@jpountz jpountz removed the review label Apr 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>test Issues or PRs that are addressing/adding tests v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants