Skip to content

Commit 6c4ccf3

Browse files
[hotfix] Improve Session #2302 fix
### What is this PR for? After the merge of #2302 breaks authentication. ### What type of PR is it? [Hot Fix] ### Todos * [x] - Fix selenium logout issue (flaky test) ### Questions: * Does the licenses files need update? * Is there breaking changes for older versions? * Does this needs documentation? Author: Prabhjyot Singh <[email protected]> Closes #2304 from prabhjyotsingh/hotfix/ImproveSession and squashes the following commits: 94ba9e7 [Prabhjyot Singh] check if modal window is present, and then close it f993b59 [Prabhjyot Singh] improve session
1 parent 55cb6b8 commit 6c4ccf3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

zeppelin-server/src/main/java/org/apache/zeppelin/rest/LoginRestApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ public Response postLogin(@FormParam("userName") String userName,
7474
try {
7575
UsernamePasswordToken token = new UsernamePasswordToken(userName, password);
7676
// token.setRememberMe(true);
77-
currentUser.login(token);
77+
7878
currentUser.getSession().stop();
7979
currentUser.getSession(true);
80+
currentUser.login(token);
8081

8182
HashSet<String> roles = SecurityUtils.getRoles();
8283
String principal = SecurityUtils.getPrincipal();

zeppelin-server/src/test/java/org/apache/zeppelin/integration/AuthenticationIT.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.File;
2222
import java.io.IOException;
2323
import java.net.URI;
24+
import java.net.URISyntaxException;
2425
import java.util.List;
2526

2627
import org.apache.commons.io.FileUtils;
@@ -146,14 +147,20 @@ private void testShowNotebookListOnNavbar() throws Exception {
146147
}
147148
}
148149

149-
private void logoutUser(String userName) {
150+
private void logoutUser(String userName) throws URISyntaxException {
150151
ZeppelinITUtils.sleep(500, false);
151152
driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" +
152153
userName + "')]")).click();
153154
ZeppelinITUtils.sleep(500, false);
154155
driver.findElement(By.xpath("//div[contains(@class, 'navbar-collapse')]//li[contains(.,'" +
155156
userName + "')]//a[@ng-click='navbar.logout()']")).click();
156-
ZeppelinITUtils.sleep(5000, false);
157+
ZeppelinITUtils.sleep(2000, false);
158+
if (driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button"))
159+
.isDisplayed()) {
160+
driver.findElement(By.xpath("//*[@id='loginModal']//div[contains(@class, 'modal-header')]/button")).click();
161+
}
162+
driver.get(new URI(driver.getCurrentUrl()).resolve("/#/").toString());
163+
ZeppelinITUtils.sleep(500, false);
157164
}
158165

159166
// @Test

0 commit comments

Comments
 (0)