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

Fixes SecurityIntegTestCase so it always adds at least one alias #33296

Merged
merged 2 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,18 @@ protected void createIndicesWithRandomAliases(String... indices) {
createIndex(indices);

if (frequently()) {
boolean noAliasAdded = true;
Copy link
Member

Choose a reason for hiding this comment

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

I think aliasAdded = false; is clearer.

IndicesAliasesRequestBuilder builder = client().admin().indices().prepareAliases();
for (String index : indices) {
if (frequently()) {
//one alias per index with prefix "alias-"
builder.addAlias(index, "alias-" + index);
noAliasAdded = false;
Copy link
Member

Choose a reason for hiding this comment

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

aliasAdded = true;

}
}
if (randomBoolean()) {
// If we get to this point and we haven't added an alias to the request we need to add one
// or the request will fail so use noAliasAdded to force adding the alias in this case
if (noAliasAdded || randomBoolean()) {
Copy link
Member

Choose a reason for hiding this comment

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

aliasAdded == false

//one alias pointing to all indices
for (String index : indices) {
builder.addAlias(index, "alias");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public void testEmptyAuthorizedIndicesSearchForAll() {
assertNoSearchHits(client().prepareSearch().get());
}

@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/33123")
public void testEmptyAuthorizedIndicesSearchForAllDisallowNoIndices() {
createIndicesWithRandomAliases("index1", "index2");
IndexNotFoundException e = expectThrows(IndexNotFoundException.class, () -> client().prepareSearch()
Expand Down