[TEST] restore throws IOException clause on all sync performRequest callers
Original commit: elastic/x-pack-elasticsearch@d114419752
This commit is contained in:
parent
5c31e20746
commit
63a5001837
|
@ -8,6 +8,8 @@ package org.elasticsearch.smoketest;
|
|||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
public class GraphWithSecurityInsufficientRoleIT extends GraphWithSecurityIT {
|
||||
|
@ -16,7 +18,7 @@ public class GraphWithSecurityInsufficientRoleIT extends GraphWithSecurityIT {
|
|||
super(testCandidate);
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
public void test() throws IOException {
|
||||
try {
|
||||
super.test();
|
||||
fail("should have failed because of missing role");
|
||||
|
|
|
@ -47,7 +47,7 @@ public class MonitoringWithSecurityInsufficientRoleIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void test() throws Exception {
|
||||
public void test() throws IOException {
|
||||
try {
|
||||
super.test();
|
||||
fail("should have failed because of missing role");
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.elasticsearch.xpack.security.authc.support.Hasher;
|
|||
import org.elasticsearch.xpack.security.authc.support.SecuredString;
|
||||
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
@ -34,7 +35,7 @@ public abstract class AbstractPrivilegeTestCase extends SecurityIntegTestCase {
|
|||
protected static final String USERS_PASSWD_HASHED = new String(Hasher.BCRYPT.hash(new SecuredString("passwd".toCharArray())));
|
||||
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri, String body,
|
||||
Map<String, String> params) throws Exception {
|
||||
Map<String, String> params) throws IOException {
|
||||
Response response = getRestClient().performRequest(method, uri, params, entityOrNull(body),
|
||||
new BasicHeader(UsernamePasswordToken.BASIC_AUTH_HEADER,
|
||||
UsernamePasswordToken.basicAuthHeaderValue(user, new SecuredString("passwd".toCharArray()))));
|
||||
|
@ -44,24 +45,24 @@ public abstract class AbstractPrivilegeTestCase extends SecurityIntegTestCase {
|
|||
assertThat(message, statusLine.getStatusCode(), is(not(greaterThanOrEqualTo(400))));
|
||||
}
|
||||
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri, String body) throws Exception {
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri, String body) throws IOException {
|
||||
assertAccessIsAllowed(user, method, uri, body, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri) throws Exception {
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri) throws IOException {
|
||||
assertAccessIsAllowed(user, method, uri, null, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri, String body) throws Exception {
|
||||
protected void assertAccessIsDenied(String user, String method, String uri, String body) throws IOException {
|
||||
assertAccessIsDenied(user, method, uri, body, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri) throws Exception {
|
||||
protected void assertAccessIsDenied(String user, String method, String uri) throws IOException {
|
||||
assertAccessIsDenied(user, method, uri, null, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri, String body,
|
||||
Map<String, String> params) throws Exception {
|
||||
Map<String, String> params) throws IOException {
|
||||
try {
|
||||
getRestClient().performRequest(method, uri, params, entityOrNull(body),
|
||||
new BasicHeader(UsernamePasswordToken.BASIC_AUTH_HEADER,
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.elasticsearch.action.bulk.BulkResponse;
|
|||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.common.network.NetworkModule;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||
|
@ -24,6 +23,7 @@ import org.elasticsearch.xpack.security.Security;
|
|||
import org.elasticsearch.xpack.security.authc.support.SecuredString;
|
||||
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
@ -73,7 +73,7 @@ public class BulkUpdateTests extends SecurityIntegTestCase {
|
|||
assertThat(getResponse.getField("bulk updated").getValue(), equalTo("bulk updated"));
|
||||
}
|
||||
|
||||
public void testThatBulkUpdateDoesNotLoseFieldsHttp() throws Exception {
|
||||
public void testThatBulkUpdateDoesNotLoseFieldsHttp() throws IOException {
|
||||
final String path = "/index1/type/1";
|
||||
final Header basicAuthHeader = new BasicHeader("Authorization",
|
||||
UsernamePasswordToken.basicAuthHeaderValue(SecuritySettingsSource.DEFAULT_USER_NAME,
|
||||
|
|
|
@ -14,6 +14,8 @@ import org.elasticsearch.test.SecuritySettingsSource;
|
|||
import org.elasticsearch.xpack.security.authc.support.SecuredString;
|
||||
import org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
import static org.elasticsearch.rest.RestStatus.UNAUTHORIZED;
|
||||
import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
|
@ -29,7 +31,7 @@ public class SecurityPluginTests extends SecurityIntegTestCase {
|
|||
.build();
|
||||
}
|
||||
|
||||
public void testThatPluginIsLoaded() throws Exception {
|
||||
public void testThatPluginIsLoaded() throws IOException {
|
||||
try {
|
||||
logger.info("executing unauthorized request to /_xpack info");
|
||||
getRestClient().performRequest("GET", "/_xpack");
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.xpack.security.transport.netty3.SecurityNetty3HttpServe
|
|||
import org.elasticsearch.xpack.security.transport.netty3.SecurityNetty3Transport;
|
||||
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.cert.CertPathBuilderException;
|
||||
|
@ -57,7 +58,7 @@ public class SslClientAuthTests extends SecurityIntegTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void testThatHttpFailsWithoutSslClientAuth() throws Exception {
|
||||
public void testThatHttpFailsWithoutSslClientAuth() throws IOException {
|
||||
SSLIOSessionStrategy sessionStrategy = new SSLIOSessionStrategy(SSLContexts.createDefault(), NoopHostnameVerifier.INSTANCE);
|
||||
try (RestClient restClient = createRestClient(httpClientBuilder -> httpClientBuilder.setSSLStrategy(sessionStrategy), "https")) {
|
||||
restClient.performRequest("GET", "/");
|
||||
|
@ -69,7 +70,7 @@ public class SslClientAuthTests extends SecurityIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testThatHttpWorksWithSslClientAuth() throws Exception {
|
||||
public void testThatHttpWorksWithSslClientAuth() throws IOException {
|
||||
Settings settings = Settings.builder()
|
||||
.put(getSSLSettingsForStore("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testclient.jks", "testclient"))
|
||||
.build();
|
||||
|
@ -83,7 +84,7 @@ public class SslClientAuthTests extends SecurityIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testThatTransportWorksWithoutSslClientAuth() throws Exception {
|
||||
public void testThatTransportWorksWithoutSslClientAuth() throws IOException {
|
||||
// specify an arbitrary keystore, that does not include the certs needed to connect to the transport protocol
|
||||
Path store = getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testclient-client-profile.jks");
|
||||
|
||||
|
|
Loading…
Reference in New Issue