test(server): cover workspace sync fence protocol (#26441)
This commit is contained in:
@@ -5,6 +5,7 @@ import { Config, Effect, FileSystem, Layer, Path } from "effect"
|
||||
import { HttpClient, HttpClientRequest, HttpRouter, HttpServer } from "effect/unstable/http"
|
||||
import * as Socket from "effect/unstable/socket/Socket"
|
||||
import { WorkspaceID } from "../../src/control-plane/schema"
|
||||
import { ControlPaths } from "../../src/server/routes/instance/httpapi/groups/control"
|
||||
import { InstancePaths } from "../../src/server/routes/instance/httpapi/groups/instance"
|
||||
import { SessionPaths } from "../../src/server/routes/instance/httpapi/groups/session"
|
||||
import { ExperimentalHttpApiServer } from "../../src/server/routes/instance/httpapi/server"
|
||||
@@ -95,6 +96,31 @@ describe("instance HttpApi", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("does not emit sync fence headers for fixed-workspace reads or no-op mutations", () =>
|
||||
Effect.gen(function* () {
|
||||
const originalWorkspaceID = Flag.OPENCODE_WORKSPACE_ID
|
||||
Flag.OPENCODE_WORKSPACE_ID = WorkspaceID.ascending()
|
||||
yield* Effect.addFinalizer(() =>
|
||||
Effect.sync(() => {
|
||||
Flag.OPENCODE_WORKSPACE_ID = originalWorkspaceID
|
||||
}),
|
||||
)
|
||||
|
||||
const dir = yield* tmpdirScoped({ git: true })
|
||||
const read = yield* HttpClientRequest.get(InstancePaths.path).pipe(directoryHeader(dir), HttpClient.execute)
|
||||
const log = yield* HttpClientRequest.post(ControlPaths.log).pipe(
|
||||
directoryHeader(dir),
|
||||
HttpClientRequest.bodyJson({ service: "fence-test", level: "info", message: "noop" }),
|
||||
Effect.flatMap(HttpClient.execute),
|
||||
)
|
||||
|
||||
expect(read.status).toBe(200)
|
||||
expect(read.headers[FenceHeader]).toBeUndefined()
|
||||
expect(log.status).toBe(200)
|
||||
expect(log.headers[FenceHeader]).toBeUndefined()
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("serves path and VCS read endpoints", () =>
|
||||
Effect.gen(function* () {
|
||||
const dir = yield* tmpdirScoped({ git: true })
|
||||
|
||||
Reference in New Issue
Block a user