Skip to content

Commit

Permalink
remove apply changeset test
Browse files Browse the repository at this point in the history
  • Loading branch information
nick4598 committed Jan 6, 2025
1 parent a6948be commit d60fd14
Showing 1 changed file with 0 additions and 55 deletions.
55 changes: 0 additions & 55 deletions packages/performance-tests/test/rawInserts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { ChangesetFileProps } from "@itwin/core-common";
import {
// eslint-disable-next-line @typescript-eslint/no-redeclare
Element,
ElementGroupsMembers,
IModelDb,
SnapshotDb,
StandaloneDb,
} from "@itwin/core-backend";
Expand All @@ -19,7 +17,6 @@ import { TestIModel } from "./TestContext";
import { generateTestIModel } from "./iModelUtils";
import { initOutputFile, timed } from "./TestUtils";
import assert from "assert";
import fs from "fs";
import path from "path";

const loggerCategory = "Raw Inserts";
Expand Down Expand Up @@ -70,41 +67,6 @@ export default async function rawInserts(

sourceDb.saveChanges();

Logger.logInfo(
loggerCategory,
"Done. Starting changeset application of same content"
);

const changeset1 = createChangeset(sourceDb);
const changesetDbPath = initOutputFile("RawInsertsApply.bim", outputDir);
if (fs.existsSync(changesetDbPath)) fs.unlinkSync(changesetDbPath);
const changesetDb = StandaloneDb.createEmpty(changesetDbPath, {
rootSubject: { name: "RawInsertsApply" },
});

const [applyChangeSetTimer] = timed(() => {
// eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
changesetDb.nativeDb.applyChangeset(changeset1);
});

reporter.addEntry(
"populate by applying changeset",
iModelName,
"time elapsed (seconds)",
applyChangeSetTimer?.elapsedSeconds ?? -1,
{
"Element Count": IModelTransformerTestUtils.count(
sourceDb,
Element.classFullName
),
"Relationship Count": IModelTransformerTestUtils.count(
sourceDb,
ElementGroupsMembers.classFullName
),
"Branch Name": branchName,
}
);

Logger.logInfo(
loggerCategory,
"Done. Starting with-provenance transformation of same content"
Expand Down Expand Up @@ -179,23 +141,6 @@ export default async function rawInserts(
);

sourceDb.close();
changesetDb.close();
targetDb.close();
targetNoProvDb.close();
}

// stolen from itwinjs-core: core/backend/src/test/changesets/ChangeMerging.test.ts
function createChangeset(imodel: IModelDb): ChangesetFileProps {
// eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
const changeset = imodel.nativeDb.startCreateChangeset();

// completeCreateChangeset deletes the file that startCreateChangeSet created.
// We make a copy of it now, before it does that.
const csFileName = path.join(outputDir, `${changeset.id}.changeset`);
fs.copyFileSync(changeset.pathname, csFileName);
changeset.pathname = csFileName;

// eslint-disable-next-line @itwin/no-internal, deprecation/deprecation
imodel.nativeDb.completeCreateChangeset({ index: 0 });
return changeset as any; // FIXME: bad peer deps
}

0 comments on commit d60fd14

Please sign in to comment.