Skip to content

feat(cmd): handle ErrEnvNotExist with typed error checking#3126

Merged
knative-prow[bot] merged 8 commits intoknative:mainfrom
intojhanurag:fix/typedError-ErrEnvNotExist
Nov 2, 2025
Merged

feat(cmd): handle ErrEnvNotExist with typed error checking#3126
knative-prow[bot] merged 8 commits intoknative:mainfrom
intojhanurag:fix/typedError-ErrEnvNotExist

Conversation

@intojhanurag
Copy link
Copy Markdown
Member

Changes

  • Introduced typed error ErrEnvNotExist to clearly indicate missing environment variables.
  • Added error check in tests using errors.As to assert that the correct typed error is returned.
  • Validates that the Name field in ErrEnvNotExist matches the expected missing environment variable.
  • Improves test reliability and clarity for environment variable management.

@knative-prow knative-prow Bot requested review from dsimansk and nainaz October 22, 2025 08:46
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented Oct 22, 2025

Hi @intojhanurag. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added needs-ok-to-test 🤖 Needs an org member to approve testing size/S 🤖 PR changes 10-29 lines, ignoring generated files. labels Oct 22, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.18%. Comparing base (d3a783c) to head (ed6e91f).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
pkg/functions/errors.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3126      +/-   ##
==========================================
+ Coverage   58.32%   60.18%   +1.85%     
==========================================
  Files         134      134              
  Lines       17369    13506    -3863     
==========================================
- Hits        10131     8128    -2003     
+ Misses       6300     4408    -1892     
- Partials      938      970      +32     
Flag Coverage Δ
e2e-tests 41.70% <0.00%> (+2.78%) ⬆️
integration-tests 54.73% <66.66%> (+2.46%) ⬆️
unit-tests 46.75% <66.66%> (+0.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@intojhanurag
Copy link
Copy Markdown
Member Author

Hey @gauron99 , It is ready for review.

Comment thread cmd/deploy_test.go
@intojhanurag
Copy link
Copy Markdown
Member Author

Hey @gauron99 , All tests passed in this pr .

@gauron99
Copy link
Copy Markdown
Contributor

/ok-to-test

@knative-prow knative-prow Bot added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels Oct 30, 2025
Comment thread cmd/deploy_test.go
Comment thread cmd/deploy.go Outdated
Comment on lines +424 to +430
type ErrEnvNotExist struct {
Name string
}

func (e ErrEnvNotExist) Error() string {
return fmt.Sprintf("environment variable %q does not exist", e.Name)
}
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.

can we put this into pkg/functions/errors.go please to keep consistent with the place for error definitions.
Otherwise looks good to me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hey @gauron99 , Thanks for this suggestion ! Now Is it good to go ?

Copy link
Copy Markdown
Contributor

@gauron99 gauron99 left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow Bot added the lgtm 🤖 PR is ready to be merged. label Nov 2, 2025
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented Nov 2, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99, intojhanurag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added the approved 🤖 PR has been approved by an approver from all required OWNERS files. label Nov 2, 2025
@knative-prow knative-prow Bot merged commit f36ac4c into knative:main Nov 2, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. lgtm 🤖 PR is ready to be merged. ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/S 🤖 PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants