Skip to content

test(contract): cover the notification list and count responses - #173

Merged
omattsson merged 1 commit into
mainfrom
test/contract-notification-counts
Oct 23, 2026
Merged

omattsson merged 1 commit into
mainfrom
test/contract-notification-counts

Conversation

@omattsson

Copy link
Copy Markdown
Owner

Follow-up to #172 and omattsson/k8s-stack-manager#697 (the capped notification counts, k8s-stack-manager #654).

Summary

  • Refresh cli/test/contract/testdata/swagger.json from k8s-stack-manager main with refresh-swagger.sh. The vendored copy was well behind; the existing cases pass against the new schema.
  • Add response contract cases:
    • types.Notification against models.Notification
    • types.PaginatedNotifications against models.PaginatedNotifications
    • types.UnreadCountResponse against models.UnreadNotificationCount

A mistyped json tag on these types (for example unread_count_caped) now fails the contract test instead of silently decoding to false. I checked this by breaking the tag locally: both the list and the count case fail with "has no matching property in swagger schema".

Note: response cases only check that each stackctl field exists in the schema. The backend's trigger field on a notification is not decoded by stackctl, and the test does not flag that.

Tests

go vet ./... and go test ./... -race -count=1 pass.

🤖 Generated with Claude Code

Refresh testdata/swagger.json from k8s-stack-manager main (it now has
#697, the capped notification counts) and add response cases for
types.Notification, types.PaginatedNotifications and
types.UnreadCountResponse (models.UnreadNotificationCount). A mistyped
json tag such as "unread_count_caped" now fails the test instead of
decoding to false.

The existing cases pass against the refreshed schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omattsson omattsson added the testing Tests and coverage label Oct 23, 2026
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@omattsson
omattsson merged commit 3dbeeef into main Oct 23, 2026
8 checks passed
@omattsson
omattsson deleted the test/contract-notification-counts branch October 24, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Tests and coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant