Fix E2E testing
This commit is contained in:
parent
82f11d8c86
commit
d45d2c0be3
2 changed files with 38 additions and 30 deletions
|
|
@ -108,10 +108,10 @@ export class MockAgent extends MockClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.random() < 0.1 && this.doResets) {
|
if (Math.random() < 0.015 && this.doResets) {
|
||||||
options.push(this.resetClient.bind(this));
|
// we can't just queue this up as once it's destroyed, no more method calls can go to SyncClient
|
||||||
}
|
await this.resetClient();
|
||||||
|
} else {
|
||||||
this.pendingActions.push(
|
this.pendingActions.push(
|
||||||
(async (): Promise<unknown> => {
|
(async (): Promise<unknown> => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -120,7 +120,9 @@ export class MockAgent extends MockClient {
|
||||||
this.client.logger.error(
|
this.client.logger.error(
|
||||||
`Failed to perform an action: ${error}`
|
`Failed to perform an action: ${error}`
|
||||||
);
|
);
|
||||||
this.client.logger.info(JSON.stringify(this.data, null, 2));
|
this.client.logger.info(
|
||||||
|
JSON.stringify(this.data, null, 2)
|
||||||
|
);
|
||||||
this.client.logger.info(
|
this.client.logger.info(
|
||||||
JSON.stringify(this.localFiles, null, 2)
|
JSON.stringify(this.localFiles, null, 2)
|
||||||
);
|
);
|
||||||
|
|
@ -129,11 +131,17 @@ export class MockAgent extends MockClient {
|
||||||
})()
|
})()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async finish(): Promise<void> {
|
public async finish(): Promise<void> {
|
||||||
await this.client.setSetting("isSyncEnabled", true);
|
await this.client.setSetting("isSyncEnabled", true);
|
||||||
// eslint-disable-next-line no-restricted-properties
|
// eslint-disable-next-line no-restricted-properties
|
||||||
await Promise.all(this.pendingActions);
|
await Promise.all(this.pendingActions);
|
||||||
|
await this.client.waitUntilFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async destroy(): Promise<void> {
|
||||||
|
await this.client.waitUntilFinished();
|
||||||
await this.client.destroy();
|
await this.client.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ async function runTest({
|
||||||
// then we need a second pass to ensure that all agents pull the same state.
|
// then we need a second pass to ensure that all agents pull the same state.
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
try {
|
try {
|
||||||
await client.finish();
|
await client.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!slowFileEvents) {
|
if (!slowFileEvents) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
@ -116,6 +116,7 @@ async function runTest({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runTests(): Promise<void> {
|
async function runTests(): Promise<void> {
|
||||||
|
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
await runTest({
|
await runTest({
|
||||||
agentCount: 2,
|
agentCount: 2,
|
||||||
concurrency: 16,
|
concurrency: 16,
|
||||||
|
|
@ -126,7 +127,6 @@ async function runTests(): Promise<void> {
|
||||||
jitterScaleInSeconds: 0.75
|
jitterScaleInSeconds: 0.75
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
|
||||||
for (const useSlowFileEvents of [false, true]) {
|
for (const useSlowFileEvents of [false, true]) {
|
||||||
for (const concurrency of [
|
for (const concurrency of [
|
||||||
16,
|
16,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue