Skip to content

test(tck): publish the template instance in a device birth - #69

Merged
dpazj merged 1 commit into
masterfrom
fix/tck-template-dbirth
Nov 3, 2026
Merged

dpazj merged 1 commit into
masterfrom
fix/tck-template-dbirth

Conversation

@dpazj

@dpazj dpazj commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the parameters-only template workaround from the tck-node example and publishes a real template instance in the device birth instead of the node birth.

  • Point has metrics x, y, z and the scale parameter again.
  • The template definition is published in the node's NBIRTH via register_template::<Point>().
  • The template instance is published in the device's DBIRTH by a new TckDeviceMetrics wrapper around the device's SimpleMetricManager.
  • No template instance is published in NBIRTH.

Why

SendDataTest.checkInstance evaluates the payloads-template-instance-members-data assertion for every message type, even though the requirement only applies to NDATA/DDATA:

setResultIfNotFail(testResults,
    found && (msgtype.equals(DBIRTH) || msgtype.equals(NDATA) || msgtype.equals(DDATA)),
    INSTANCE_MEMBERS_DATA, ...);

For an instance in NBIRTH, msgtype is NBIRTH so the expression is always false, even when the instance contains every definition metric. The previous workaround avoided the failure by declaring a template with no metrics, which left the four member assertions NOT EXECUTED.

With the instance in a DBIRTH, msgtype is DBIRTH and the expression is found, so the assertion executes and passes.

Result

edge:SendDataTest         PASS   44 assertions: 44 passed   (was 40 passed, 4 not executed)
edge:SendComplexDataTest  PASS   48 assertions: 48 passed

All four template member assertions (definition-members, instance-members, instance-members-birth, instance-members-data) now run and pass.

cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, and cargo test pass.

The TCK's SendDataTest fails an instance in NBIRTH when the template
definition has metrics: its instance-members-data check requires the
message type to be DBIRTH, NDATA or DDATA even for NBIRTH instances. Work
around the broken assertion by keeping the definition on the node and
publishing the instance in the device birth, where the check passes.

The template now has real metrics (x, y, z) plus the scale parameter, so
SendDataTest executes and passes all 44 assertions instead of leaving the
four template member checks unexecuted.
@dpazj
dpazj merged commit 70a22df into master Nov 3, 2026
7 checks passed
@dpazj
dpazj deleted the fix/tck-template-dbirth branch November 3, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant