Skip to content

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

TypeScript

test(hcc): cover reviewed decimal resource quantities

Alfredo Lopez8d1c8b93f770
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index 938e400a2..449526342 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.377",
+ "version": "0.1.378",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.377",
+ "version": "0.1.378",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/codex-catalog-projection": "file:../packages/codex-catalog-projection",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index ef4a910fe..020d17edc 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.377",
+ "version": "0.1.378",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/test/hostReconciler.lifecycle.test.ts b/host-context-controller/test/hostReconciler.lifecycle.test.ts
index d1cb138bd..b10deb414 100644
--- a/host-context-controller/test/hostReconciler.lifecycle.test.ts
+++ b/host-context-controller/test/hostReconciler.lifecycle.test.ts
@@ -700,6 +700,8 @@ describe('HostReconciler resource rollout bootstrap', () => {
for (const kind of ['requests', 'limits'] as const) {
const values = container.resources?.[kind]
if (values?.cpu === '1000m') values.cpu = '1'
+ if (values?.cpu === '0.1') values.cpu = '100m'
+ if (values?.cpu === '0.025') values.cpu = '25m'
if (values?.memory === '1024Mi') values.memory = '1Gi'
}
}
@@ -992,6 +994,47 @@ describe('HostReconciler resource rollout bootstrap', () => {
}
)
+ it('keeps the reviewed decimal CPU no-op stable across four canonicalized reconciles', async () => {
+ config.hostResources.requests.cpu = '0.1'
+ const fixture = await runtime({ canonicalResources: true, consumed: false })
+ const revision = fixture.secret().metadata!.annotations![SECRET_REVISION]
+ for (let pass = 0; pass < 4; pass++) {
+ await fixture.reconcile()
+ fixture.advance()
+ }
+ expect(issue).not.toHaveBeenCalled()
+ expect(fixture.templateChanges()).toBe(0)
+ expect(fixture.deployment().metadata!.generation).toBe(1)
+ expect(fixture.secret().metadata!.annotations![SECRET_REVISION]).toBe(revision)
+ expect(fixture.deployment().spec!.template.spec!.containers[0].resources!.requests!.cpu).toBe(
+ '100m'
+ )
+ })
+
+ it('rolls the reviewed decimal CPU transition once and settles after four canonicalized reconciles', async () => {
+ const fixture = await runtime({ canonicalResources: true })
+ config.hostResources.requests.cpu = '0.025'
+ await fixture.reconcile()
+ expect(fixture.events).toEqual(['issue', 'persist-secret', 'replace-deployment'])
+ const prepared = fixture.secret().metadata!.annotations![SECRET_REVISION]
+ const appliedGeneration = fixture.deployment().metadata!.generation
+ expect(appliedGeneration).toBe(2)
+ for (let pass = 0; pass < 4; pass++) {
+ fixture.advance()
+ await fixture.reconcile()
+ }
+ expect(issue).toHaveBeenCalledOnce()
+ expect(fixture.templateChanges()).toBe(1)
+ expect(fixture.deployment().metadata!.generation).toBe(appliedGeneration)
+ expect(fixture.deployment().spec!.template.metadata!.annotations![APPLIED_REVISION]).toBe(
+ prepared
+ )
+ expect(fixture.deployment().spec!.template.spec!.containers[0].resources!.requests!.cpu).toBe(
+ '25m'
+ )
+ expect(fixture.secret().metadata!.annotations![BOOTSTRAP]).toBe('consumed')
+ })
+
it('defers resource preparation when retained OAuth authority is temporarily unobserved', async () => {
const fixture = await runtime({ oauth: true })
config.hostResources.requests.cpu = '25m'