parent
a379daf78e
commit
97faa8d1b4
|
|
@ -35,7 +35,7 @@ import org.testng.annotations.Test;
|
|||
public class MultiUserWorkspaceActivityManagerTest {
|
||||
private static final long DEFAULT_TIMEOUT = 60_000L; // 1 minute
|
||||
private static final long USER_LIMIT_TIMEOUT = 120_000L; // 2 minutes
|
||||
private static final long DEFAULT_HARD_EXPIRATION_TIMEOUT = 60000 * 60 * 3; // 3 hours
|
||||
private static final long DEFAULT_RUN_TIMEOUT = 0; // No default run timeout
|
||||
|
||||
@Mock private AccountManager accountManager;
|
||||
@Mock private ResourceManager resourceManager;
|
||||
|
|
@ -60,7 +60,7 @@ public class MultiUserWorkspaceActivityManagerTest {
|
|||
accountManager,
|
||||
resourceManager,
|
||||
DEFAULT_TIMEOUT,
|
||||
DEFAULT_HARD_EXPIRATION_TIMEOUT);
|
||||
DEFAULT_RUN_TIMEOUT);
|
||||
|
||||
when(account.getId()).thenReturn("account123");
|
||||
when(accountManager.getByName(anyString())).thenReturn(account);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class InmemoryWorkspaceActivityDao implements WorkspaceActivityDao {
|
|||
.filter(
|
||||
a ->
|
||||
(a.getExpiration() != null && a.getExpiration() < timestamp)
|
||||
|| (runTimeout > 0 && a.getLastRunning() - a.getLastStarting() > runTimeout))
|
||||
|| (runTimeout > 0 && timestamp - a.getLastRunning() > runTimeout))
|
||||
.map(WorkspaceActivity::getWorkspaceId)
|
||||
.collect(toList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,10 +169,6 @@ public class WorkspaceActivity {
|
|||
this.expiration = expiration;
|
||||
}
|
||||
|
||||
public Long getRunTimeout() {
|
||||
return this.lastRunning - this.lastStarting;
|
||||
}
|
||||
|
||||
public WorkspaceStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
|
@ -189,7 +185,6 @@ public class WorkspaceActivity {
|
|||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WorkspaceActivity activity = (WorkspaceActivity) o;
|
||||
return Objects.equals(workspaceId, activity.workspaceId)
|
||||
&& Objects.equals(created, activity.created)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import org.testng.annotations.Test;
|
|||
public class WorkspaceActivityCheckerTest {
|
||||
private static final long DEFAULT_TIMEOUT = 60_000L; // 1 minute
|
||||
private static final long DEFAULT_RUN_TIMEOUT = 0; // No default run timeout
|
||||
private static final long ACTIVE_RUN_TIMEOUT = 60000 * 60 * 3; // 3 hours
|
||||
|
||||
private ManualClock clock;
|
||||
private WorkspaceActivityChecker checker;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ public class WorkspaceActivityManagerTest {
|
|||
|
||||
private static final long DEFAULT_TIMEOUT = 60_000L; // 1 minute
|
||||
private static final long DEFAULT_RUN_TIMEOUT = 0; // No run timeout
|
||||
private static final long ACTIVE_RUN_TIMEOUT = 60000 * 60 * 3; // 3 hours
|
||||
|
||||
@Mock private WorkspaceManager workspaceManager;
|
||||
|
||||
|
|
@ -108,19 +107,6 @@ public class WorkspaceActivityManagerTest {
|
|||
assertEquals(wsIdCaptor.getValue(), wsId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldRemoveRunTimeoutWhenWorkspaceStopped() throws Exception {
|
||||
final String wsId = "testWsId";
|
||||
final EventSubscriber<WorkspaceStatusEvent> subscriber = subscribeAndGetStatusEventSubscriber();
|
||||
|
||||
subscriber.onEvent(
|
||||
DtoFactory.newDto(WorkspaceStatusEvent.class)
|
||||
.withStatus(WorkspaceStatus.STOPPED)
|
||||
.withWorkspaceId(wsId));
|
||||
ArgumentCaptor<String> wsIdCaptor = ArgumentCaptor.forClass(String.class);
|
||||
verify(workspaceActivityDao, times(1)).removeExpiration(wsIdCaptor.capture());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCeaseToTrackTheWorkspaceActivityAfterStopping() throws Exception {
|
||||
final String wsId = "testWsId";
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ public class WorkspaceActivityDaoTest {
|
|||
a.setExpiration(base * 1_000_000);
|
||||
|
||||
activities[i] = a;
|
||||
System.out.println("activity is " + a);
|
||||
}
|
||||
|
||||
accountTckRepository.createAll(asList(accounts));
|
||||
|
|
|
|||
Loading…
Reference in New Issue