From 8996fc3538735d7ad2d447bc7c4221b08c6c2be5 Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Tue, 12 Nov 2024 15:56:43 -0500 Subject: [PATCH] test: Fixed two assertions to work against older versions of `openai` (#2726) --- test/versioned/openai/chat-completions.test.js | 9 +++++---- test/versioned/openai/embeddings.test.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/versioned/openai/chat-completions.test.js b/test/versioned/openai/chat-completions.test.js index e9bd94043a..28254d7500 100644 --- a/test/versioned/openai/chat-completions.test.js +++ b/test/versioned/openai/chat-completions.test.js @@ -360,10 +360,11 @@ if (semver.gte(pkgVersion, '4.12.2')) { const events = agent.customEventAggregator.events.toArray() assert.equal(events.length, 0) // we will still record the external segment but not the chat completion - assertSegments(tx.trace.root, [ - 'timers.setTimeout', - `External/${host}:${port}/chat/completions` - ]) + assertSegments( + tx.trace.root, + ['timers.setTimeout', `External/${host}:${port}/chat/completions`], + { exact: false } + ) tx.end() end() diff --git a/test/versioned/openai/embeddings.test.js b/test/versioned/openai/embeddings.test.js index 48fbe652ef..3538f7c111 100644 --- a/test/versioned/openai/embeddings.test.js +++ b/test/versioned/openai/embeddings.test.js @@ -146,7 +146,7 @@ test('embedding invalid payload errors should be tracked', (t, end) => { }, customAttributes: { 'http.statusCode': 403, - 'error.message': '403 You are not allowed to generate embeddings from this model', + 'error.message': /You are not allowed to generate embeddings from this model/, 'error.code': null, 'error.param': null, 'completion_id': undefined,