Skip to content

test(kubernetes): cover attribute handler's main paths - #416

Merged
refeed merged 1 commit into
StackGuardian:mainfrom
afsuyadi:test-numeric-comparison
Oct 21, 2026
Merged

refeed merged 1 commit into
StackGuardian:mainfrom
afsuyadi:test-numeric-comparison

Conversation

@afsuyadi

Copy link
Copy Markdown
Contributor

Description

What changes are being made?
I add some unit tests for Kubernetes with 4 cases:
a. test_kind_not_found: Ask the handler for a ConfigMap, but input.yml has no ConfigMap in it.
-> Expects: an error ("kind:ConfigMap is not found") plus a ProviderError with severity_value == 1.

b. test_plain_path: Asks for metadata.name on the Role resource (a path with no *), and there is exactly one Role.
-> Expects: a single plain value back, "access-role", not wrapped in a list.

c. test_wildcard_path: Asks for spec.selector.matchLabels.* on the Deployment resource. The * symbol means "give me every value at this level".
-> Expects: a list of all matched values, ["wfs-demo", "wfs-demp"].

d. test_missing_attribute: Asks for metadata.labels on RoleBinding, but that resource has no labels key at all.
-> Expects: None. Proving the handler doesn't crash on a missing field, it just reports "nothing here".

Which issues or tickets does this PR close or relate to?
Related issue: fixes #405

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Other (please specify): Test cases for Kubernetes

Checklist

  • Code has been linted.
  • Documentation has been updated (if needed).
  • Tests have been added or updated (if needed).
  • Any breaking changes have been communicated to the team.

Screenshots or Recordings (if applicable)

Additional Information

@afsuyadi

Copy link
Copy Markdown
Contributor Author

Hi @refeed , please inform me if there is anything needed to be added for this PR. Thanks!

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@refeed refeed left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks @afsuyadi !

@refeed
refeed merged commit dd97588 into StackGuardian:main Oct 21, 2026
9 checks passed
@refeed

refeed commented Oct 21, 2026

Copy link
Copy Markdown
Member

Thank you so much for this contribution @afsuyadi!💙 We truly value the time and care you put into improving Tirith, and it means a lot to see the community help shape it. If you’re sharing your work on LinkedIn, don’t forget to tag StackGuardian so we can cheer you on! Keep them coming. We’re excited to see what you build next 😇

@afsuyadi

afsuyadi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you so much for this contribution @afsuyadi!💙 We truly value the time and care you put into improving Tirith, and it means a lot to see the community help shape it. If you’re sharing your work on LinkedIn, don’t forget to tag StackGuardian so we can cheer you on! Keep them coming. We’re excited to see what you build next 😇

Sure do! @refeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(kubernetes): cover the provider's main paths

2 participants