From ea7e24d5369d9c3dd44f8e818745c54b8a373357 Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Thu, 5 Jun 2025 13:25:10 -0700 Subject: [PATCH 1/8] fix tests that are failing on github ci --- mappings/bulk-api-query-get-7508Z00000lTqQCQA0-result.json | 1 + mappings/bulk-api-query-get-more-results.json | 1 + mappings/bulk-api-query-get-results-server-error.json | 1 + test/sdk/bulk-api.test.ts | 3 +-- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mappings/bulk-api-query-get-7508Z00000lTqQCQA0-result.json b/mappings/bulk-api-query-get-7508Z00000lTqQCQA0-result.json index 0079eb6..4157ce0 100644 --- a/mappings/bulk-api-query-get-7508Z00000lTqQCQA0-result.json +++ b/mappings/bulk-api-query-get-7508Z00000lTqQCQA0-result.json @@ -1,4 +1,5 @@ { + "priority": 2, "request": { "method": "GET", "urlPath": "/services/data/v56.0/jobs/query/7508Z00000lTqQCQA0/results" diff --git a/mappings/bulk-api-query-get-more-results.json b/mappings/bulk-api-query-get-more-results.json index 94c81f6..64f2651 100644 --- a/mappings/bulk-api-query-get-more-results.json +++ b/mappings/bulk-api-query-get-more-results.json @@ -1,4 +1,5 @@ { + "priority": 1, "request": { "method": "GET", "urlPath": "/services/data/v56.0/jobs/query/7508Z00000lTqQCQA0/results", diff --git a/mappings/bulk-api-query-get-results-server-error.json b/mappings/bulk-api-query-get-results-server-error.json index 4b3699a..5cc2772 100644 --- a/mappings/bulk-api-query-get-results-server-error.json +++ b/mappings/bulk-api-query-get-results-server-error.json @@ -1,4 +1,5 @@ { + "priority": 1, "request": { "method": "GET", "urlPath": "/services/data/v56.0/jobs/query/7508Z00000lTqQCQA0/results", diff --git a/test/sdk/bulk-api.test.ts b/test/sdk/bulk-api.test.ts index 061ab31..4d5e2a1 100644 --- a/test/sdk/bulk-api.test.ts +++ b/test/sdk/bulk-api.test.ts @@ -705,8 +705,7 @@ describe("bulkApi", function () { ]); }); - // TODO: This is getting skipped because it only fails in ubuntu, it falls back incorrectly. - it.skip("should be possible to get more results for a query job and specify the maximum records to return", async () => { + it("should be possible to get more results for a query job and specify the maximum records to return", async () => { const currentResults: QueryJobResults = { locator: "MjAwMOMG", done: false, From 25c91ee09532993a6af625651075174113b5c5df Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 09:50:00 -0700 Subject: [PATCH 2/8] change the bulk to avoid crashes with memory issues in testing --- test/sdk/bulk-api.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sdk/bulk-api.test.ts b/test/sdk/bulk-api.test.ts index 4d5e2a1..fba850b 100644 --- a/test/sdk/bulk-api.test.ts +++ b/test/sdk/bulk-api.test.ts @@ -1054,7 +1054,7 @@ function createSmallDataset(bulkApi: BulkApi) { } function createLargeDataset(bulkApi: BulkApi) { - return createDataTableUpToSizeInBytes(bulkApi, 200 * SIZE_1_MB); + return createDataTableUpToSizeInBytes(bulkApi, 100 * SIZE_1_MB); } async function useScenario(name: string) { From 57d3d1d20085b50689ce110c7df83d339e523bfa Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 10:57:02 -0700 Subject: [PATCH 3/8] fixed heap issues --- .github/workflows/build.yml | 2 +- package.json | 2 +- test/sdk/bulk-api.test.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 385f5c6..dcf5cdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: version: [22.x, 20.x, 18.x] - os: [sfdc-hk-ubuntu-latest, sfdc-hk-windows-latest] + os: [sfdc-hk-ubuntu-latest, sfdc-hk-macos-latest, sfdc-hk-windows-latest] name: Node ${{ matrix.version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: diff --git a/package.json b/package.json index c3c3a4a..88472b2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "tsc -b", "lint": "eslint . --ext .ts --max-warnings 0 --report-unused-disable-directives --format codeframe", "lint:fix": "npm run lint -- --fix", - "wiremock": "wiremock --port 8080 --bind-address 127.0.0.1 --disable-banner", + "wiremock": "java -Xmx1024m -Xms512m -jar $(which wiremock) --port 8080 --bind-address 127.0.0.1 --disable-banner", "mocha": "mocha", "test": "cross-env NODE_ENV=test TS_NODE_PROJECT=tsconfig.test.json concurrently -k -s first \"wiremock\" \"mocha\"", "test:coverage": "nyc --reporter=lcov --reporter=text-summary yarn test", diff --git a/test/sdk/bulk-api.test.ts b/test/sdk/bulk-api.test.ts index fba850b..8770cc4 100644 --- a/test/sdk/bulk-api.test.ts +++ b/test/sdk/bulk-api.test.ts @@ -72,6 +72,7 @@ describe("bulkApi", function () { describe("ingest", () => { beforeEach(async () => { await resetScenarios(); + await clearScenarioMemory(); }); it("ingesting a small dataset", async () => { @@ -1054,7 +1055,7 @@ function createSmallDataset(bulkApi: BulkApi) { } function createLargeDataset(bulkApi: BulkApi) { - return createDataTableUpToSizeInBytes(bulkApi, 100 * SIZE_1_MB); + return createDataTableUpToSizeInBytes(bulkApi, 200 * SIZE_1_MB); } async function useScenario(name: string) { @@ -1074,6 +1075,12 @@ async function setScenarioState(name: string, state: string): Promise { } } +async function clearScenarioMemory() { + const res = await fetch(`${WIREMOCK_URL}/__admin/requests`, { + method: "DELETE", + }); +} + async function resetScenarios() { const res = await fetch(`${WIREMOCK_URL}/__admin/scenarios/reset`, { method: "POST", From 6c8c2d4b897f553ec67ca810c7356324966a5981 Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 10:58:16 -0700 Subject: [PATCH 4/8] lint arrrrr --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcf5cdc..0907431 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,8 @@ jobs: fail-fast: false matrix: version: [22.x, 20.x, 18.x] - os: [sfdc-hk-ubuntu-latest, sfdc-hk-macos-latest, sfdc-hk-windows-latest] + os: + [sfdc-hk-ubuntu-latest, sfdc-hk-macos-latest, sfdc-hk-windows-latest] name: Node ${{ matrix.version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: From 992ee35e6670aac4661423ca4415710bcfc986d7 Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 11:01:16 -0700 Subject: [PATCH 5/8] oops forgot to check res --- test/sdk/bulk-api.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/sdk/bulk-api.test.ts b/test/sdk/bulk-api.test.ts index 8770cc4..5fcaa5a 100644 --- a/test/sdk/bulk-api.test.ts +++ b/test/sdk/bulk-api.test.ts @@ -1079,6 +1079,12 @@ async function clearScenarioMemory() { const res = await fetch(`${WIREMOCK_URL}/__admin/requests`, { method: "DELETE", }); + + if (!res.ok) { + throw new Error( + `could not clear wiremock scenario memory` + ); + } } async function resetScenarios() { From 7435bfc3b82aac37d7e1982a52f23b36837882c3 Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 11:02:36 -0700 Subject: [PATCH 6/8] llllliiiiint --- test/sdk/bulk-api.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/sdk/bulk-api.test.ts b/test/sdk/bulk-api.test.ts index 5fcaa5a..0c69ad5 100644 --- a/test/sdk/bulk-api.test.ts +++ b/test/sdk/bulk-api.test.ts @@ -1081,9 +1081,7 @@ async function clearScenarioMemory() { }); if (!res.ok) { - throw new Error( - `could not clear wiremock scenario memory` - ); + throw new Error(`could not clear wiremock scenario memory`); } } From 4b8ff10c0a4112e9d89165dfd440950832eb9fac Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 13:56:35 -0700 Subject: [PATCH 7/8] switch to env --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88472b2..3787be1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "tsc -b", "lint": "eslint . --ext .ts --max-warnings 0 --report-unused-disable-directives --format codeframe", "lint:fix": "npm run lint -- --fix", - "wiremock": "java -Xmx1024m -Xms512m -jar $(which wiremock) --port 8080 --bind-address 127.0.0.1 --disable-banner", + "wiremock": "JAVA_OPTS='-Xmx1024m -Xms512m' wiremock --port 8080 --bind-address 127.0.0.1 --disable-banner", "mocha": "mocha", "test": "cross-env NODE_ENV=test TS_NODE_PROJECT=tsconfig.test.json concurrently -k -s first \"wiremock\" \"mocha\"", "test:coverage": "nyc --reporter=lcov --reporter=text-summary yarn test", From 92f19a9c1cf863f62767804838c33e932ed70e71 Mon Sep 17 00:00:00 2001 From: Daniel Bright Date: Fri, 6 Jun 2025 14:03:10 -0700 Subject: [PATCH 8/8] fixed skip --- mappings/data-api-create-invalid-token-session-error.json | 6 +++--- test/sdk/data-api.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mappings/data-api-create-invalid-token-session-error.json b/mappings/data-api-create-invalid-token-session-error.json index 6ab1f59..77b0196 100644 --- a/mappings/data-api-create-invalid-token-session-error.json +++ b/mappings/data-api-create-invalid-token-session-error.json @@ -4,13 +4,13 @@ "urlPath": "/services/data/v51.0/sobjects/Account" }, "response": { - "status": 400, + "status": 401, "headers": { "Content-Type": "application/json;charset=UTF-8" }, "jsonBody": { - "errorCode": "NOT_FOUND", - "message": "blah" + "errorCode": "INVALID_SESSION_ID", + "message": "Session expired or invalid" } } } diff --git a/test/sdk/data-api.ts b/test/sdk/data-api.ts index 53800df..bb8835a 100644 --- a/test/sdk/data-api.ts +++ b/test/sdk/data-api.ts @@ -86,8 +86,7 @@ describe("DataApi Class", async () => { }); describe("invalid token", async () => { - // TODO: skipping because this doesn't appear possible, how is the promise be rejected but the req return a body? - it.skip("throws an invalid session error", async () => { + it("throws an invalid session error", async () => { try { await dataApiInvalidToken.create({ type: "Account",