HEMS: add per-hems tests for nil statements when unconfigured or not connected#31430
HEMS: add per-hems tests for nil statements when unconfigured or not connected#31430andig wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
relay_test.go,assert.Equal(t, new(1e3), c.MaxConsumptionPower())will not compile becausenewexpects a type, not a value; consider using a small helper likeptr(1000.0)or taking the address of a typed literal instead. - Since
TestNotConnectedineebus_test.gois intentionally failing to highlight a bug, consider marking it witht.Skipand a clear TODO or gating it behind a build tag so that the main test suite can still pass until the underlying issue is fixed. - The
boolGhelper infnn_test.gois a useful pattern; if similar boolean getters are needed in other HEMS tests, consider consolidating it in a shared test utility to avoid duplication.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `relay_test.go`, `assert.Equal(t, new(1e3), c.MaxConsumptionPower())` will not compile because `new` expects a type, not a value; consider using a small helper like `ptr(1000.0)` or taking the address of a typed literal instead.
- Since `TestNotConnected` in `eebus_test.go` is intentionally failing to highlight a bug, consider marking it with `t.Skip` and a clear TODO or gating it behind a build tag so that the main test suite can still pass until the underlying issue is fixed.
- The `boolG` helper in `fnn_test.go` is a useful pattern; if similar boolean getters are needed in other HEMS tests, consider consolidating it in a shared test utility to avoid duplication.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@premultiply was würden wir hier erwarten? Genau dafür gibts ja egtl. die Failsafe Values? |
|
In dem Fall würde Passivität herrschen (dauerhaft nicht gedimmt) bzw. eine statische Vorgabe des Anlagenbetreibers wäre umzusetzen (z.B dauerhaft 100, 70, 60, 50 oder 0%. In anderen Ländern durchaus auch andere / freie Werte, häufig dann auch als Leistungswert mit dem Netzbetreiber vereinbart). Fallback ist etwas anderes: Das gilt erst wenn diese Daten mindestens einmal von der Steuerbox auch tatsächlich übermittelt wurden und dann die Verbindung zu dieser bzw. zum Netzbetreiber temporär abbricht. |
Adds unit tests per HEMS asserting that Curtailed()/Dimmed() and the underlying power functions (CurtailedPercent, MaxConsumptionPower, MaxProductionPower) return nil when curtailment or dimming are not configured (FNN, Relay) or when no upstream controlbox has connected (EEBus).
TestNotConnectedfails intentionally — MaxConsumptionPower, CurtailedPercent and hence Dimmed()/Curtailed() report values even though no controlbox ever connected. Only MaxProductionPower already returns nil. Tests expose the bug; no fix included per request.Based on #31428.
🤖 Generated with Claude Code