Skip to content

Commit

Permalink
ci: Start redis client for agent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Dec 2, 2024
1 parent 76655de commit eb709f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions control-plane/src/modules/workflows/agent/agent.ai.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { DynamicStructuredTool } from "@langchain/core/tools";
import { createWorkflowAgent } from "./agent";
import { z } from "zod";
import { ulid } from "ulid";
import { SpecialResultTypes } from "./tools/functions";
import { assertResultMessage } from "../workflow-messages";
import { WorkflowAgentStateMessage } from "./state";
import { redisClient } from "../../redis";

if (process.env.CI) {
jest.retryTimes(3);
Expand Down Expand Up @@ -34,8 +32,20 @@ describe("Agent", () => {
}),
];

beforeAll(async () => {
// Ensure Redis client is connected
await redisClient?.connect();
});

afterAll(async () => {
// Close Redis connection after all tests
await redisClient?.quit();
});

beforeEach(async () => {
toolCallback.mockReset();
// Clear all keys in Redis before each test
await redisClient?.flushAll();
});

describe("function calling", () => {
Expand Down
4 changes: 2 additions & 2 deletions control-plane/src/modules/workflows/agent/nodes/tool-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const _handleToolCall = async (
try {
tool = await getTool(toolCall);
} catch (error) {
customerTelemetry.track({
await customerTelemetry.track({
type: "toolCall",
toolName,
clusterId: workflow.clusterId,
Expand Down Expand Up @@ -364,7 +364,7 @@ const _handleToolCall = async (
toolName,
});

customerTelemetry.track({
await customerTelemetry.track({
type: "toolCall",
toolName,
clusterId: workflow.clusterId,
Expand Down

0 comments on commit eb709f3

Please sign in to comment.