refactor(instance): retire WithInstance adapter (#27782)
This commit is contained in:
@@ -3,9 +3,8 @@ import path from "path"
|
||||
import { unlink } from "fs/promises"
|
||||
|
||||
import { ProviderID } from "../../src/provider/schema"
|
||||
import { disposeAllInstances, tmpdir } from "../fixture/fixture"
|
||||
import { disposeAllInstances, tmpdir, withTestInstance } from "../fixture/fixture"
|
||||
import type { InstanceContext } from "../../src/project/instance-context"
|
||||
import { WithInstance } from "../../src/project/with-instance"
|
||||
import { Provider } from "@/provider/provider"
|
||||
import { Env } from "../../src/env"
|
||||
import { Global } from "@opencode-ai/core/global"
|
||||
@@ -64,7 +63,7 @@ test("Bedrock: config region takes precedence over AWS_REGION env var", async ()
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_REGION", "us-east-1")
|
||||
@@ -87,7 +86,7 @@ test("Bedrock: falls back to AWS_REGION env var when no config region", async ()
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_REGION", "eu-west-1")
|
||||
@@ -140,7 +139,7 @@ test("Bedrock: loads when bearer token from auth.json is present", async () => {
|
||||
}),
|
||||
)
|
||||
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "")
|
||||
@@ -184,7 +183,7 @@ test("Bedrock: config profile takes precedence over AWS_PROFILE env var", async
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
@@ -214,7 +213,7 @@ test("Bedrock: includes custom endpoint in options when specified", async () =>
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
@@ -245,7 +244,7 @@ test("Bedrock: autoloads when AWS_WEB_IDENTITY_TOKEN_FILE is present", async ()
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_WEB_IDENTITY_TOKEN_FILE", "/var/run/secrets/eks.amazonaws.com/serviceaccount/token")
|
||||
@@ -286,7 +285,7 @@ test("Bedrock: model with us. prefix should not be double-prefixed", async () =>
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
@@ -321,7 +320,7 @@ test("Bedrock: model with global. prefix should not be prefixed", async () => {
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
@@ -355,7 +354,7 @@ test("Bedrock: model with eu. prefix should not be double-prefixed", async () =>
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
@@ -389,7 +388,7 @@ test("Bedrock: model without prefix in US region should get us. prefix added", a
|
||||
)
|
||||
},
|
||||
})
|
||||
await WithInstance.provide({
|
||||
await withTestInstance({
|
||||
directory: tmp.path,
|
||||
fn: async (ctx) => {
|
||||
set(ctx, "AWS_PROFILE", "default")
|
||||
|
||||
Reference in New Issue
Block a user