Fix E2E tests
This commit is contained in:
parent
29ff601545
commit
f8b0501eea
4 changed files with 5 additions and 30 deletions
|
|
@ -104,32 +104,6 @@ async fn internal_update_document(
|
||||||
|
|
||||||
let sanitized_relative_path = sanitize_path(&relative_path);
|
let sanitized_relative_path = sanitize_path(&relative_path);
|
||||||
|
|
||||||
// Return the latest version if the update is a no-op from the client's
|
|
||||||
// perspective
|
|
||||||
if content == parent_document.content
|
|
||||||
&& sanitized_relative_path == parent_document.relative_path
|
|
||||||
{
|
|
||||||
info!("Document content is the same as the parent version, skipping update");
|
|
||||||
|
|
||||||
let latest_version = state
|
|
||||||
.database
|
|
||||||
.get_latest_document(&vault_id, &document_id, None)
|
|
||||||
.await
|
|
||||||
.map_err(server_error)?
|
|
||||||
.map_or_else(
|
|
||||||
|| {
|
|
||||||
Err(not_found_error(anyhow!(
|
|
||||||
"Document with id `{document_id}` not found",
|
|
||||||
)))
|
|
||||||
},
|
|
||||||
Ok,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
return Ok(Json(DocumentUpdateResponse::FastForwardUpdate(
|
|
||||||
latest_version.into(),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut transaction = state
|
let mut transaction = state
|
||||||
.database
|
.database
|
||||||
.create_write_transaction(&vault_id)
|
.create_write_transaction(&vault_id)
|
||||||
|
|
|
||||||
|
|
@ -274,9 +274,8 @@ export class Syncer {
|
||||||
typeof globalThis !== "undefined" &&
|
typeof globalThis !== "undefined" &&
|
||||||
typeof globalThis.WebSocket === "undefined"
|
typeof globalThis.WebSocket === "undefined"
|
||||||
) {
|
) {
|
||||||
// polyfill for WebSocket in Node.js
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
globalThis.WebSocket = require("ws");
|
globalThis.WebSocket = require("ws"); // polyfill for WebSocket in Node.js
|
||||||
}
|
}
|
||||||
|
|
||||||
this.applyRemoteChangesWebSocket = new WebSocket(wsUri);
|
this.applyRemoteChangesWebSocket = new WebSocket(wsUri);
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ export class MockClient implements FileSystemOperations {
|
||||||
{
|
{
|
||||||
assert(
|
assert(
|
||||||
newParts.includes(part),
|
newParts.includes(part),
|
||||||
`Part ${part} not found in new content`
|
`Part ${part} not found in new content: ${newContent}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,12 @@ async function runTest({
|
||||||
const settings = `with ${agentCount} agents, concurrency ${concurrency}, iterations ${iterations}, doDeletes ${doDeletes}, jitterScaleInSeconds ${jitterScaleInSeconds}, useSlowFileEvents ${useSlowFileEvents}`;
|
const settings = `with ${agentCount} agents, concurrency ${concurrency}, iterations ${iterations}, doDeletes ${doDeletes}, jitterScaleInSeconds ${jitterScaleInSeconds}, useSlowFileEvents ${useSlowFileEvents}`;
|
||||||
console.info(`Running test ${settings}`);
|
console.info(`Running test ${settings}`);
|
||||||
|
|
||||||
|
const vaultName = uuidv4();
|
||||||
|
console.info(`Using vault name: ${vaultName}`);
|
||||||
const initialSettings: Partial<SyncSettings> = {
|
const initialSettings: Partial<SyncSettings> = {
|
||||||
isSyncEnabled: true,
|
isSyncEnabled: true,
|
||||||
token: "test-token-change-me", // same as in backend/config-e2e.yml
|
token: "test-token-change-me", // same as in backend/config-e2e.yml
|
||||||
vaultName: uuidv4(),
|
vaultName,
|
||||||
syncConcurrency: concurrency,
|
syncConcurrency: concurrency,
|
||||||
remoteUri: "http://localhost:3000"
|
remoteUri: "http://localhost:3000"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue