Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(hcc): de-vacuum the ingress-retention test [R3-H7]

Alfredo Lopez83a674ec1df3
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index fbbf245c7..18c51daa9 100644
--- a/host-context-controller/package-lock.json
+++ b/host-context-controller/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.205",
+ "version": "0.1.206",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.205",
+ "version": "0.1.206",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index c4a5ea094..83463b8fe 100644
--- a/host-context-controller/package.json
+++ b/host-context-controller/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.205",
+ "version": "0.1.206",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/src/networkPolicyReconciler.test.ts b/host-context-controller/src/networkPolicyReconciler.test.ts
index b4f31744c..9c9fe099d 100644
--- a/host-context-controller/src/networkPolicyReconciler.test.ts
+++ b/host-context-controller/src/networkPolicyReconciler.test.ts
@@ -933,13 +933,25 @@ describe('NetworkPolicyReconciler', () => {
return {}
}
)
+ // The delete mock MUST remove from livePolicies, or the port-4000
+ // assertion below survives a spurious deletion and the test passes with
+ // the bug reinjected (R3-H7).
+ mockApi.deleteNamespacedNetworkPolicy.mockImplementation(async ({ namespace, name }) => {
+ livePolicies.delete(`${namespace}/${name}`)
+ return {}
+ })
await rec.reconcileContext(context)
- expect(mockApi.deleteNamespacedNetworkPolicy).not.toHaveBeenCalledWith({
- name: 'ctx-dev-mongo',
- namespace: 'mcp-server',
- })
+ // Filter the real calls by name+namespace: the production delete always
+ // carries `preconditions`, so `not.toHaveBeenCalledWith({name,namespace})`
+ // never matched any call and was vacuously true (R3-H7).
+ const deletedCtxDevMongo = mockApi.deleteNamespacedNetworkPolicy.mock.calls.some(
+ call =>
+ (call[0] as { name?: string; namespace?: string })?.name === 'ctx-dev-mongo' &&
+ (call[0] as { name?: string; namespace?: string })?.namespace === 'mcp-server'
+ )
+ expect(deletedCtxDevMongo).toBe(false)
const ingress = livePolicies.get('mcp-server/ctx-dev-mongo')
expect(ingress?.spec?.ingress?.[0]?.ports).toEqual([expect.objectContaining({ port: 4000 })])
})