From b439f657fb99cb86577d93316c4e46cb75551683 Mon Sep 17 00:00:00 2001 From: Aditya Pandey Date: Tue, 2 Jul 2024 15:24:31 -0500 Subject: [PATCH] Add assert for eTags and uploadLinks --- packages/replay/src/main.ts | 3 +++ packages/test-utils/src/legacy-cli/main.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/replay/src/main.ts b/packages/replay/src/main.ts index 3a6f4507..f2379962 100644 --- a/packages/replay/src/main.ts +++ b/packages/replay/src/main.ts @@ -5,6 +5,7 @@ import { getPackument } from "query-registry"; import { compare } from "semver"; import dbg from "./debug"; import { getCurrentVersion, getHttpAgent } from "./utils"; +import assert from "node:assert/strict"; // requiring v4 explicitly because it's the last version with commonjs support. // Should be upgraded to the latest when converting this code to es modules. @@ -241,6 +242,8 @@ async function multipartUploadRecording( agentOptions ); + assert(eTags.length === partLinks.length, "Mismatched eTags and partLinks"); + await client.connectionEndRecordingMultipartUpload(recording.id, uploadId, eTags); return recordingId; } diff --git a/packages/test-utils/src/legacy-cli/main.ts b/packages/test-utils/src/legacy-cli/main.ts index a789767e..16426ca5 100644 --- a/packages/test-utils/src/legacy-cli/main.ts +++ b/packages/test-utils/src/legacy-cli/main.ts @@ -2,6 +2,7 @@ import { retryWithExponentialBackoff } from "@replay-cli/shared/async/retryOnFai import fs from "fs"; import dbg from "./debug"; import { getHttpAgent } from "./utils"; +import assert from "node:assert/strict"; // requiring v4 explicitly because it's the last version with commonjs support. // Should be upgraded to the latest when converting this code to es modules. @@ -226,6 +227,8 @@ async function multipartUploadRecording( agentOptions ); + assert(eTags.length === partLinks.length, "Mismatched eTags and partLinks"); + await client.connectionEndRecordingMultipartUpload(recording.id, uploadId, eTags); return recordingId; }