Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: fix flaky test (#2826)

Hassieb Pakzad1f0e7b2c3722
diff --git a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
index 83c04bed87..f45e6fbcad 100644
--- a/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
+++ b/worker/src/services/IngestionService/tests/IngestionService.integration.test.ts
@@ -1195,12 +1195,13 @@ describe("Ingestion end-to-end tests", () => {
it("null does not override set values", async () => {
const traceId = randomUUID();
+ const timestamp = Date.now();
const traceEventList: TraceEventType[] = [
{
id: randomUUID(),
type: "trace-create",
- timestamp: new Date().toISOString(),
+ timestamp: new Date(timestamp).toISOString(),
body: {
id: traceId,
name: "trace-name",
@@ -1213,7 +1214,7 @@ describe("Ingestion end-to-end tests", () => {
{
id: randomUUID(),
type: "trace-create",
- timestamp: new Date().toISOString(),
+ timestamp: new Date(timestamp + 1).toISOString(),
body: {
id: traceId,
name: "trace-name",
diff --git a/worker/src/services/IngestionService/utils.ts b/worker/src/services/IngestionService/utils.ts
index 4c4d2ba68b..c92aee5bce 100644
--- a/worker/src/services/IngestionService/utils.ts
+++ b/worker/src/services/IngestionService/utils.ts
@@ -81,7 +81,7 @@ export function overwriteObject(
nonOverwritableKeys: string[]
) {
const result = _.mergeWith({}, a, b, (objValue, srcValue, key) => {
- if (nonOverwritableKeys.includes(key)) {
+ if (nonOverwritableKeys.includes(key) || srcValue == null) {
return objValue;
} else {
return srcValue;
diff --git a/worker/src/utils/shutdown.ts b/worker/src/utils/shutdown.ts
index c2e68ccd06..df2f623383 100644
--- a/worker/src/utils/shutdown.ts
+++ b/worker/src/utils/shutdown.ts
@@ -1,5 +1,7 @@
import logger from "../logger";
+import { redis } from "@langfuse/shared/src/server";
+
import { evalJobCreator, evalJobExecutor } from "../queues/evalQueue";
import { batchExportJobExecutor } from "../queues/batchExportQueue";
import { flushIngestionQueueExecutor } from "../queues/ingestionFlushQueue";