Skip to content

Commit

Permalink
test(ls): remove ref validation performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Sep 1, 2023
1 parent 76fb5a1 commit 2e8a2b9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 166 deletions.
104 changes: 0 additions & 104 deletions packages/apidom-ls/test/fixtures/deref/invalid-full.json

This file was deleted.

62 changes: 0 additions & 62 deletions packages/apidom-ls/test/validate-references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const spec = fs.readFileSync(path.join(__dirname, 'fixtures', 'deref', 'invalid.
const specValid = fs
.readFileSync(path.join(__dirname, 'fixtures', 'deref', 'valid-same-ref.json'))
.toString();
const specFullExternal = fs
.readFileSync(path.join(__dirname, 'fixtures', 'deref', 'invalid-full.json'))
.toString();

describe('reference validation', function () {
const lsContext: LanguageServiceContext = {
Expand Down Expand Up @@ -359,63 +356,4 @@ describe('reference validation', function () {
);
});
});
// measure performance of validation with concurrent and serial processing
// using external references as input, to be run manually kept here for reference
// eslint-disable-next-line mocha/no-skipped-tests
specify.skip('should measure validation performance', async function () {
const sleep = (delay: number | undefined) =>
new Promise((resolve) => {
setTimeout(resolve, delay);
});
this.timeout(50000);
const localLsContext: LanguageServiceContext = {
metadata: metadata(),
validatorProviders: [],
performanceLogs: true,
logLevel,
};

let validationContext: ValidationContext = {
comments: DiagnosticSeverity.Error,
maxNumberOfProblems: 100,
relatedInformation: false,
referenceValidationMode: ReferenceValidationMode.APIDOM_INDIRECT_EXTERNAL,
referenceValidationSequentialProcessing: true,
};

const doc: TextDocument = TextDocument.create(
'foo://bar/invalid.json',
'json',
0,
specFullExternal,
);
console.log('serial processing');
// eslint-disable-next-line no-plusplus
for (let i = 0; i < 10; i++) {
// eslint-disable-next-line no-await-in-loop
await sleep(1000);
let localLanguageService: LanguageService | null = getLanguageService(localLsContext);
// eslint-disable-next-line no-await-in-loop
await localLanguageService.doValidation(doc, validationContext);
localLanguageService.terminate();
localLanguageService = null;
}
validationContext = {
comments: DiagnosticSeverity.Error,
maxNumberOfProblems: 100,
relatedInformation: false,
referenceValidationMode: ReferenceValidationMode.APIDOM_INDIRECT_EXTERNAL,
};
console.log('concurrent processing');
// eslint-disable-next-line no-plusplus
for (let i = 0; i < 10; i++) {
// eslint-disable-next-line no-await-in-loop
await sleep(1000);
let localLanguageService: LanguageService | null = getLanguageService(localLsContext);
// eslint-disable-next-line no-await-in-loop
await localLanguageService.doValidation(doc, validationContext);
localLanguageService.terminate();
localLanguageService = null;
}
});
});

0 comments on commit 2e8a2b9

Please sign in to comment.