Skip to content

Commit 99155fb

Browse files
committed
Match decide spans by input instead of order in the decisions test
1 parent 81b6bc0 commit 99155fb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • dev-packages/node-integration-tests/suites/tracing/openai/v7

‎dev-packages/node-integration-tests/suites/tracing/openai/v7/test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ conditionalTest({ min: 22 })('OpenAI integration (V7)', () => {
179179
const spans = (await spansPromise).filter(span => span.attributes[SENTRY_OP]?.value === GEN_AI_DECIDE);
180180
expect(spans).toHaveLength(3);
181181

182-
const [textSpan, imageSpan] = spans.filter(span => span.status === 'ok');
182+
// Both successful spans are named `decide gpt-6-luna` and may arrive in any order, so match on the input.
183+
const inputOf = (span: (typeof spans)[number]): string => String(span.attributes[GEN_AI_INPUT_MESSAGES]?.value);
184+
const textSpan = spans.find(span => inputOf(span).includes('charged twice'));
185+
const imageSpan = spans.find(span => inputOf(span).includes('input_image'));
183186
expect(textSpan!.name).toBe('decide gpt-6-luna');
184187
expect(textSpan!.attributes).toMatchObject({
185188
[SENTRY_ORIGIN]: { value: 'auto.ai.openai' },

0 commit comments

Comments
 (0)