mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #13107 from overleaf/em-reenable-swap-job-test
Reenable swap job test in git bridge GitOrigin-RevId: 4fcef9d1b9a6ef169b14ec490b785daeb80ab418
This commit is contained in:
parent
ebbb4fd6d0
commit
a5834a0f8c
3 changed files with 11 additions and 8 deletions
|
@ -64,7 +64,7 @@ public interface SwapJob {
|
|||
if (!cfg.isPresent()) {
|
||||
return new NoopSwapJob();
|
||||
}
|
||||
if (!swapStore.isSafe()) {
|
||||
if (!swapStore.isSafe() && !cfg.get().getAllowUnsafeStores()) {
|
||||
Log.warn("Swap store '{}' is not safe; disabling swap job", swapStore.getClass().getSimpleName());
|
||||
return new NoopSwapJob();
|
||||
}
|
||||
|
|
|
@ -13,19 +13,22 @@ public class SwapJobConfig {
|
|||
private final int highGiB;
|
||||
private final long intervalMillis;
|
||||
private final String compressionMethod;
|
||||
private final boolean allowUnsafeStores;
|
||||
|
||||
public SwapJobConfig(
|
||||
int minProjects,
|
||||
int lowGiB,
|
||||
int highGiB,
|
||||
long intervalMillis,
|
||||
String compressionMethod
|
||||
String compressionMethod,
|
||||
boolean allowUnsafeStores
|
||||
) {
|
||||
this.minProjects = minProjects;
|
||||
this.lowGiB = lowGiB;
|
||||
this.highGiB = highGiB;
|
||||
this.intervalMillis = intervalMillis;
|
||||
this.compressionMethod = compressionMethod;
|
||||
this.allowUnsafeStores = allowUnsafeStores;
|
||||
}
|
||||
|
||||
public int getMinProjects() {
|
||||
|
@ -44,6 +47,10 @@ public class SwapJobConfig {
|
|||
return intervalMillis;
|
||||
}
|
||||
|
||||
public boolean getAllowUnsafeStores() {
|
||||
return allowUnsafeStores;
|
||||
}
|
||||
|
||||
public SwapJob.CompressionMethod getCompressionMethod() {
|
||||
CompressionMethod result = SwapJob.stringToCompressionMethod(compressionMethod);
|
||||
if (result == null) {
|
||||
|
|
|
@ -662,11 +662,6 @@ public class WLGitBridgeIntegrationTest {
|
|||
|
||||
}
|
||||
|
||||
// We skip this test because it now hangs. It relies on the in-memory swap
|
||||
// job, but we disable the swap job when the noop or in-memory swap store
|
||||
// are configured. We do that for safety. Such a configuration in a
|
||||
// production environment would lead to data loss.
|
||||
@Ignore
|
||||
@Test
|
||||
public void wlgbCanSwapProjects(
|
||||
) throws IOException, GitAPIException, InterruptedException {
|
||||
|
@ -677,7 +672,7 @@ public class WLGitBridgeIntegrationTest {
|
|||
server.start();
|
||||
server.setState(states.get("wlgbCanSwapProjects").get("state"));
|
||||
wlgb = new GitBridgeApp(new String[] {
|
||||
makeConfigFile(33874, 3874, new SwapJobConfig(1, 0, 0, 250, null))
|
||||
makeConfigFile(33874, 3874, new SwapJobConfig(1, 0, 0, 250, null, true))
|
||||
});
|
||||
wlgb.run();
|
||||
File rootGitDir = new File(wlgb.config.getRootGitDirectory());
|
||||
|
@ -1099,6 +1094,7 @@ public class WLGitBridgeIntegrationTest {
|
|||
" \"s3BucketName\": \"com.overleaf.testbucket\"\n" +
|
||||
" },\n" +
|
||||
" \"swapJob\": {\n" +
|
||||
" \"allowUnsafeStores\": true," +
|
||||
" \"minProjects\": " +
|
||||
swapCfg.getMinProjects() +
|
||||
",\n" +
|
||||
|
|
Loading…
Reference in a new issue