[TEST] fixes tests that attempt to delete documents from missing

indices, as that is now prohibited by elastic/elasticsearch#24518

relates elastic/x-pack-elasticsearch#1511

Original commit: elastic/x-pack-elasticsearch@026a516196
This commit is contained in:
Ali Beyad 2017-05-22 13:16:53 -04:00
parent e0a8881cfc
commit f158be89b8
2 changed files with 5 additions and 6 deletions

View File

@ -101,10 +101,11 @@ public class NativeRealmIntegTests extends NativeRealmIntegTestCase {
} }
} }
@AwaitsFix(bugUrl = "https://github.com/elastic/x-pack-elasticsearch/pull/1507")
public void testDeletingNonexistingUserAndRole() throws Exception { public void testDeletingNonexistingUserAndRole() throws Exception {
SecurityClient c = securityClient(); SecurityClient c = securityClient();
DeleteUserResponse resp = c.prepareDeleteUser("joe").get(); // first create the index so it exists
c.preparePutUser("joe", "s3kirt".toCharArray(), "role1", "user").get();
DeleteUserResponse resp = c.prepareDeleteUser("missing").get();
assertFalse("user shouldn't be found", resp.found()); assertFalse("user shouldn't be found", resp.found());
DeleteRoleResponse resp2 = c.prepareDeleteRole("role").get(); DeleteRoleResponse resp2 = c.prepareDeleteRole("role").get();
assertFalse("role shouldn't be found", resp2.found()); assertFalse("role shouldn't be found", resp2.found());

View File

@ -14,6 +14,7 @@ import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.update.UpdateAction; import org.elasticsearch.action.update.UpdateAction;
import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.Requests; import org.elasticsearch.client.Requests;
import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.index.engine.DocumentMissingException; import org.elasticsearch.index.engine.DocumentMissingException;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.test.SecurityIntegTestCase;
@ -54,7 +55,6 @@ public class WriteActionsTests extends SecurityIntegTestCase {
BulkAction.NAME + "[s]"); BulkAction.NAME + "[s]");
} }
@AwaitsFix(bugUrl = "https://github.com/elastic/x-pack-elasticsearch/issues/1511")
public void testDelete() { public void testDelete() {
createIndex("test1", "index1"); createIndex("test1", "index1");
client().prepareIndex("test1", "type", "id").setSource("field", "value").get(); client().prepareIndex("test1", "type", "id").setSource("field", "value").get();
@ -62,9 +62,7 @@ public class WriteActionsTests extends SecurityIntegTestCase {
assertThrowsAuthorizationExceptionDefaultUsers(client().prepareDelete("index1", "type", "id")::get, BulkAction.NAME + "[s]"); assertThrowsAuthorizationExceptionDefaultUsers(client().prepareDelete("index1", "type", "id")::get, BulkAction.NAME + "[s]");
assertEquals(RestStatus.NOT_FOUND, client().prepareDelete("test4", "type", "id").get().status()); expectThrows(IndexNotFoundException.class, () -> client().prepareDelete("test4", "type", "id").get());
assertThrowsAuthorizationExceptionDefaultUsers(client().prepareDelete("missing", "type", "id")::get, BulkAction.NAME + "[s]");
} }
public void testUpdate() { public void testUpdate() {