Merge PR #7155: test(ai): stop bedrock payload suites from needing ambient AWS auth (@wolfiesch)
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { streamBedrock } from "@oh-my-pi/pi-ai/providers/amazon-bedrock";
|
||||
import type { Context, FetchImpl, Model } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { Effort } from "@oh-my-pi/pi-catalog/effort";
|
||||
import { withEnv } from "./helpers";
|
||||
|
||||
// These suites capture the request payload from a fire-and-forget stream, so a
|
||||
// credential lookup that rejects after the test ends surfaces as an unhandled
|
||||
// error against whatever runs next. Skip Bedrock auth: the payload is built
|
||||
// before signing and no request leaves the process.
|
||||
const originalSkipAuth = process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
|
||||
beforeAll(() => {
|
||||
process.env.AWS_BEDROCK_SKIP_AUTH = "1";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (originalSkipAuth === undefined) delete process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
else process.env.AWS_BEDROCK_SKIP_AUTH = originalSkipAuth;
|
||||
});
|
||||
|
||||
const profileArn = "arn:aws:bedrock:us-east-2:1234567890:application-inference-profile/company-opus-48";
|
||||
const profileModel: Model<"bedrock-converse-stream"> = buildModel({
|
||||
id: profileArn,
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { streamBedrock } from "@oh-my-pi/pi-ai/providers/amazon-bedrock";
|
||||
import type { Context, Model } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
import { getBundledModel } from "@oh-my-pi/pi-catalog/models";
|
||||
import { withEnv } from "./helpers";
|
||||
|
||||
// These suites capture the request payload from a fire-and-forget stream, so a
|
||||
// credential lookup that rejects after the test ends surfaces as an unhandled
|
||||
// error against whatever runs next. Skip Bedrock auth: the payload is built
|
||||
// before signing and no request leaves the process.
|
||||
const originalSkipAuth = process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
|
||||
beforeAll(() => {
|
||||
process.env.AWS_BEDROCK_SKIP_AUTH = "1";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (originalSkipAuth === undefined) delete process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
else process.env.AWS_BEDROCK_SKIP_AUTH = originalSkipAuth;
|
||||
});
|
||||
|
||||
interface CachePoint {
|
||||
cachePoint: { type: "default"; ttl?: "1h" };
|
||||
}
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
import { streamBedrock } from "@oh-my-pi/pi-ai/providers/amazon-bedrock";
|
||||
import type { Context, Model } from "@oh-my-pi/pi-ai/types";
|
||||
import { buildModel } from "@oh-my-pi/pi-catalog/build";
|
||||
|
||||
// These suites capture the request payload from a fire-and-forget stream, so a
|
||||
// credential lookup that rejects after the test ends surfaces as an unhandled
|
||||
// error against whatever runs next. Skip Bedrock auth: the payload is built
|
||||
// before signing and no request leaves the process.
|
||||
const originalSkipAuth = process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
|
||||
beforeAll(() => {
|
||||
process.env.AWS_BEDROCK_SKIP_AUTH = "1";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (originalSkipAuth === undefined) delete process.env.AWS_BEDROCK_SKIP_AUTH;
|
||||
else process.env.AWS_BEDROCK_SKIP_AUTH = originalSkipAuth;
|
||||
});
|
||||
|
||||
interface Payload {
|
||||
system?: Array<{ text: string } | { cachePoint: unknown }>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user