mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add a test for when migrated-from project is not present
This commit is contained in:
parent
aa267a59da
commit
c553094a60
5 changed files with 63 additions and 0 deletions
|
@ -120,6 +120,9 @@ public class WLGitBridgeIntegrationTest {
|
|||
put("canMigrateRepository", new HashMap<String, SnapshotAPIState>() {{
|
||||
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/canMigrateRepository/state/state.json")).build());
|
||||
}});
|
||||
put("skipMigrationWhenMigratedFromMissing", new HashMap<String, SnapshotAPIState>() {{
|
||||
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/skipMigrationWhenMigratedFromMissing/state/state.json")).build());
|
||||
}});
|
||||
}};
|
||||
|
||||
@Rule
|
||||
|
@ -805,9 +808,28 @@ public class WLGitBridgeIntegrationTest {
|
|||
File testprojDir2 = gitClone("testproj2", gitBridgePort, dir);
|
||||
wlgb.stop();
|
||||
|
||||
// Second project content is equal to content of the first
|
||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canMigrateRepository/state/testproj"), testprojDir2.toPath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void skipMigrationWhenMigratedFromMissing() throws IOException, GitAPIException, InterruptedException {
|
||||
int gitBridgePort = 33882;
|
||||
int mockServerPort = 3882;
|
||||
MockSnapshotServer server = new MockSnapshotServer(mockServerPort, getResource("/skipMigrationWhenMigratedFromMissing").toFile());
|
||||
server.start();
|
||||
server.setState(states.get("skipMigrationWhenMigratedFromMissing").get("state"));
|
||||
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
|
||||
makeConfigFile(gitBridgePort, mockServerPort)
|
||||
});
|
||||
wlgb.run();
|
||||
// don't clone the source project first
|
||||
File testprojDir2 = gitClone("testproj2", gitBridgePort, dir);
|
||||
wlgb.stop();
|
||||
|
||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/skipMigrationWhenMigratedFromMissing/state/testproj2"), testprojDir2.toPath()));
|
||||
}
|
||||
|
||||
private String makeConfigFile(
|
||||
int port,
|
||||
int apiPort
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
[
|
||||
{
|
||||
"project": "testproj2",
|
||||
"getDoc": {
|
||||
"versionID": 1,
|
||||
"createdAt": "2014-11-30T18:40:58.123Z",
|
||||
"email": "jdleesmiller+1@gmail.com",
|
||||
"name": "John+1",
|
||||
"migratedFromId": "testprojthatdoesnotexist"
|
||||
},
|
||||
"getSavedVers": [],
|
||||
"getForVers": [
|
||||
{
|
||||
"versionID": 1,
|
||||
"srcs": [
|
||||
{
|
||||
"content": "two\n",
|
||||
"path": "main.tex"
|
||||
},
|
||||
{
|
||||
"content": "This text is from another file.",
|
||||
"path": "foo/bar/test.tex"
|
||||
}
|
||||
],
|
||||
"atts": [
|
||||
{
|
||||
"url": "http://127.0.0.1:3857/state/testproj/min_mean_wait_evm_7_eps_150dpi.png",
|
||||
"path": "min_mean_wait_evm_7_eps_150dpi.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"push": "success",
|
||||
"postback": {
|
||||
"type": "success",
|
||||
"versionID": 2
|
||||
}
|
||||
}
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
This text is from another file.
|
|
@ -0,0 +1 @@
|
|||
two
|
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Loading…
Reference in a new issue