fix(plugin): address kubernetes greptile timeouts

This commit is contained in:
Dotta
2026-05-12 12:45:46 -05:00
committed by Chris Farhood
parent 39d81c732c
commit 45621aac53
5 changed files with 22 additions and 10 deletions
@@ -39,10 +39,11 @@ describe("buildNetworkPolicyManifests", () => {
it("includes user-supplied CIDRs in egress allow", () => {
const [, egress] = buildNetworkPolicyManifests({ ...baseInput, egressAllowCidrs: ["10.0.0.0/8"] });
const cidrRule = egress.spec.egress.find((r: { to: { ipBlock?: { cidr: string } }[] }) =>
const cidrRule = egress.spec.egress.find((r: { to: { ipBlock?: { cidr: string } }[]; ports?: { protocol: string; port: number }[] }) =>
r.to.some((t) => t.ipBlock?.cidr === "10.0.0.0/8"),
);
expect(cidrRule).toBeDefined();
expect(cidrRule?.ports).toEqual([{ protocol: "TCP", port: 443 }]);
});
it("adds a public HTTPS fallback when standard mode receives FQDN allow-list entries", () => {
@@ -22,7 +22,7 @@ describe("execInPod", () => {
});
const result = await execInPod({} as never, "ns", "pod-1", "agent", ["echo", "ok"]);
expect(result).toEqual({ exitCode: 0, stdout: "ok\n", stderr: "" });
expect(result).toEqual({ exitCode: 0, timedOut: false, stdout: "ok\n", stderr: "" });
});
it("returns an execution failure if the websocket closes before a status frame", async () => {
@@ -35,6 +35,7 @@ describe("execInPod", () => {
await expect(resultPromise).resolves.toMatchObject({
exitCode: 1,
timedOut: false,
stderr: expect.stringContaining("websocket closed before status frame"),
});
});
@@ -45,6 +46,7 @@ describe("execInPod", () => {
const result = await execInPod({} as never, "ns", "pod-1", "agent", ["sleep", "60"], undefined, 5);
expect(result.exitCode).toBe(1);
expect(result.timedOut).toBe(true);
expect(result.stderr).toContain("Kubernetes exec timed out after 5ms");
});
});