mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 20:46:28 +01:00
test(grok): update runtime probe mocks and isolate CI provenance
This commit is contained in:
1 parent
abb72a8008
commit
15799ccf75
3 files changed
+30
-4
No files matched your search
@@ -17,7 +17,10 @@ import {
|
||||
setOverridePaused,
|
||||
} from "../adapters/registry.js";
|
||||
|
||||
vi.mock("@paperclipai/paperclip-runner/live", () => ({ probeAcpxClaudeInstallation: vi.fn(async () => undefined) }));
|
||||
vi.mock("@paperclipai/paperclip-runner/live", () => ({
|
||||
probeAcpxClaudeInstallation: vi.fn(async () => undefined),
|
||||
probeAcpxGrokInstallation: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
const externalAdapter: ServerAdapterModule = {
|
||||
type: "external_test",
|
||||
|
||||
@@ -4,8 +4,14 @@ import { listServerAdapters, requireServerAdapter } from "./registry.js";
|
||||
import * as executionTarget from "@paperclipai/adapter-utils/execution-target";
|
||||
import { BUILTIN_ADAPTER_TYPES } from "./builtin-adapter-types.js";
|
||||
|
||||
const { probeInstallation } = vi.hoisted(() => ({ probeInstallation: vi.fn() }));
|
||||
vi.mock("@paperclipai/paperclip-runner/live", () => ({ probeAcpxClaudeInstallation: probeInstallation }));
|
||||
const { probeInstallation, probeGrokInstallation } = vi.hoisted(() => ({
|
||||
probeInstallation: vi.fn(),
|
||||
probeGrokInstallation: vi.fn(),
|
||||
}));
|
||||
vi.mock("@paperclipai/paperclip-runner/live", () => ({
|
||||
probeAcpxClaudeInstallation: probeInstallation,
|
||||
probeAcpxGrokInstallation: probeGrokInstallation,
|
||||
}));
|
||||
|
||||
// The registry registers a login capability for the two built-in interactive
|
||||
// adapters. The test checks the scalar values and the presence of the required
|
||||
@@ -86,7 +92,10 @@ describe("built-in runtime connection tool delivery", () => {
|
||||
|
||||
|
||||
describe("native ACPX environment checks", () => {
|
||||
beforeEach(() => { probeInstallation.mockReset().mockResolvedValue(undefined); });
|
||||
beforeEach(() => {
|
||||
probeInstallation.mockReset().mockResolvedValue(undefined);
|
||||
probeGrokInstallation.mockReset().mockResolvedValue(undefined);
|
||||
});
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
const context = {
|
||||
@@ -111,6 +120,17 @@ describe("native ACPX environment checks", () => {
|
||||
expect(probeInstallation).toHaveBeenCalledWith(context.config.model);
|
||||
});
|
||||
|
||||
it.each([true, false])("checks Grok's own installation readiness (%s)", async (ready) => {
|
||||
if (!ready) probeGrokInstallation.mockRejectedValueOnce(new Error("Grok executable digest mismatch"));
|
||||
const result = await requireServerAdapter("paperclip_runner").testEnvironment!({
|
||||
...context,
|
||||
config: { provider: "acpx", acpxAgent: "grok", model: "grok-4.7" },
|
||||
});
|
||||
expect(result.status).toBe(ready ? "pass" : "fail");
|
||||
expect(probeGrokInstallation).toHaveBeenCalledWith("grok-4.7");
|
||||
expect(probeInstallation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not use the host platform to reject a remote environment", async () => {
|
||||
vi.spyOn(process, "platform", "get").mockReturnValue("darwin");
|
||||
const result = await requireServerAdapter("paperclip_runner").testEnvironment!({
|
||||
|
||||
@@ -115,6 +115,9 @@ describe("runner E2E campaign history", () => {
|
||||
});
|
||||
|
||||
it("records the resolved paid target instead of the trusted workflow checkout", () => {
|
||||
vi.stubEnv("GITHUB_SERVER_URL", "");
|
||||
vi.stubEnv("GITHUB_REPOSITORY", "");
|
||||
vi.stubEnv("GITHUB_RUN_ID", "");
|
||||
vi.stubEnv("PAPERCLIP_RUNNER_E2E_SOURCE_SHA", "target-sha");
|
||||
vi.stubEnv("PAPERCLIP_RUNNER_E2E_SOURCE_REF", "refs/heads/target");
|
||||
vi.stubEnv("GITHUB_SHA", "trusted-master-sha");
|
||||
|
||||
Reference in new issue
Block a user