mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
prevent concurrent test execution in DirAccessTest
This commit is contained in:
parent
7860259ecf
commit
b14b97e637
1 changed files with 18 additions and 14 deletions
|
|
@ -28,24 +28,28 @@ public class DirAccessTest extends AbstractTestRestApi {
|
|||
|
||||
@Test
|
||||
public void testDirAccessForbidden() throws Exception {
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "false");
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();
|
||||
HttpClient httpClient = new HttpClient();
|
||||
GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
|
||||
httpClient.executeMethod(getMethod);
|
||||
AbstractTestRestApi.shutDown();
|
||||
assert getMethod.getStatusCode() == HttpStatus.SC_FORBIDDEN;
|
||||
synchronized (this) {
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "false");
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();
|
||||
HttpClient httpClient = new HttpClient();
|
||||
GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
|
||||
httpClient.executeMethod(getMethod);
|
||||
AbstractTestRestApi.shutDown();
|
||||
assert getMethod.getStatusCode() == HttpStatus.SC_FORBIDDEN;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirAccessOk() throws Exception {
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "true");
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();
|
||||
HttpClient httpClient = new HttpClient();
|
||||
GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
|
||||
httpClient.executeMethod(getMethod);
|
||||
AbstractTestRestApi.shutDown();
|
||||
assert getMethod.getStatusCode() == HttpStatus.SC_OK;
|
||||
synchronized (this) {
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_DEFAULT_DIR_ALLOWED.getVarName(), "true");
|
||||
AbstractTestRestApi.startUpWithAuthenticationEnable();
|
||||
HttpClient httpClient = new HttpClient();
|
||||
GetMethod getMethod = new GetMethod(getUrlToTest() + "/app/");
|
||||
httpClient.executeMethod(getMethod);
|
||||
AbstractTestRestApi.shutDown();
|
||||
assert getMethod.getStatusCode() == HttpStatus.SC_OK;
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getUrlToTest() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue