Skip to content

Test: add full payload JSON round-trip test in SystemStatusTests - #2221

Open
denizguney wants to merge 1 commit into
apple:mainfrom
denizguney:patch-4
Open

Test: add full payload JSON round-trip test in SystemStatusTests#2221
denizguney wants to merge 1 commit into
apple:mainfrom
denizguney:patch-4

Conversation

@denizguney

Copy link
Copy Markdown

Adds a new unit test to verify that system status payloads with nested paths and resource counts correctly round-trip through JSON encoding and decoding.

Important

All commits must be signed and verified. Pull requests containing unsigned or unverified commits cannot be built or merged. See the GitHub documentation for instructions.

For all but trivial fixes, make sure to first create a GitHub issue that concisely describes the bug or desired enhancement as justification for the change. Large PRs with no justifying issue will be closed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Adds comprehensive JSON round-trip unit test coverage for SystemStatusTests to ensure correct encoding/decoding of nested paths and resource counts.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Adds a new unit test to verify that system status payloads with nested paths and resource counts correctly round-trip through JSON encoding and decoding.
let decoded = try JSONDecoder().decode(Application.StatusPayload.self, from: Data(json.utf8))

#expect(decoded.paths?.appRoot == "/app")
#expect(decoded.resources?.containersTotal == 10)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denizguney This seems quite specific. Is it provable that these values will hold under all conditions?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, these values are currently specific to this sample test payload. Our main goal here is to isolate and verify the correct parsing and type safety of the StatusPayload structure. However, I can make the test more robust or document that this is strictly a deterministic validation for this specific mock fixture. Let me know if you'd prefer a more dynamic approach or if adjusting the fixture assertions works best!"

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.

2 participants