Repository navigation
test(kubernetes): cover attribute handler's main paths - #416
Conversation
|
Hi @refeed , please inform me if there is anything needed to be added for this PR. Thanks! |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
|
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 |
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 aConfigMap, butinput.ymlhas noConfigMapin it.-> Expects: an error ("kind:ConfigMap is not found") plus a ProviderError with severity_value == 1.
b.
test_plain_path: Asks formetadata.nameon the Role resource (a path with no *), and there is exactly oneRole.-> Expects: a single plain value back,
"access-role", not wrapped in a list.c.
test_wildcard_path: Asks forspec.selector.matchLabels.*on theDeploymentresource. 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
Checklist
Screenshots or Recordings (if applicable)
Additional Information