From 20818a314231a5942ee06fda12c050090dfeb586 Mon Sep 17 00:00:00 2001 From: Boris Gvozdev Date: Mon, 13 Mar 2023 08:08:23 +1100 Subject: [PATCH] NONE: add some more logging around builds --- src/sync/build.ts | 3 +++ src/sync/pull-requests.test.ts | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/sync/build.ts b/src/sync/build.ts index babf81d62b..e1102d56ef 100644 --- a/src/sync/build.ts +++ b/src/sync/build.ts @@ -57,6 +57,9 @@ export const getBuildTask = async ( }; } + logger.info(`Found ${workflow_runs.length} workflow_runs`); + logger.info(`First workflow_run.updated_at=${workflow_runs[0].updated_at}`); + const builds = await getTransformedBuilds(workflow_runs, gitHubInstallationClient, logger); logger.info("Syncing Builds: finished"); diff --git a/src/sync/pull-requests.test.ts b/src/sync/pull-requests.test.ts index 9c2dc0e71c..ce40dfee7b 100644 --- a/src/sync/pull-requests.test.ts +++ b/src/sync/pull-requests.test.ts @@ -223,11 +223,13 @@ describe("sync/pull-request", () => { let repoSyncState: RepoSyncState; + const PRS_INITIAL_CURSOR = 21; + beforeEach(async () => { repoSyncState = (await new DatabaseStateCreator() .withActiveRepoSyncState() .repoSyncStatePendingForPrs() - .withPrsCustomCursor("21") + .withPrsCustomCursor(String(PRS_INITIAL_CURSOR)) .create()).repoSyncState!; when(jest.mocked(booleanFlag)) @@ -338,10 +340,10 @@ describe("sync/pull-request", () => { jiraHost }, sentry, getLogger("test"))).toResolve(); expect(nock.isDone()).toBeTruthy(); - expect((await RepoSyncState.findByPk(repoSyncState!.id)).pullCursor).toEqual("26"); + expect((await RepoSyncState.findByPk(repoSyncState!.id)).pullCursor).toEqual(String(Number(PRS_INITIAL_CURSOR) + 5)); }); - it("parallel fetching when FF is over 5", async () => { + it("uses parallel fetching of 2 pages when FF is over 5", async () => { pullRequestList[0].title = "TES-15"; @@ -396,10 +398,10 @@ describe("sync/pull-request", () => { }, sentry, getLogger("test"))).toResolve(); expect(nockPage1.isDone()).toBeTruthy(); expect(nockPage2.isDone()).toBeTruthy(); - expect((await RepoSyncState.findByPk(repoSyncState!.id)).pullCursor).toEqual("31"); + expect((await RepoSyncState.findByPk(repoSyncState!.id)).pullCursor).toEqual(String(Number(PRS_INITIAL_CURSOR) + 10)); }); - it("parallel fetching when FF is over 5 should stop", async () => { + it("processing of PRs with parallel fetching ON should stop when no more PRs from GitHub", async () => { pullRequestList[0].title = "TES-15";