func icon indicating copy to clipboard operation
func copied to clipboard

Add validation and unit test for empty credentials

Open intojhanurag opened this issue 2 months ago • 12 comments

This PR improves the NewPromptForCredentials function by adding validation to handle empty username or password inputs. It ensures users cannot proceed with blank credentials.

Additionally, a new unit test has been added to verify that the function correctly returns an error when either field is left empty.

Screenshot 2025-10-30 000714

intojhanurag avatar Oct 29 '25 18:10 intojhanurag

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.

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[bot] avatar Oct 29 '25 18:10 knative-prow[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 55.64%. Comparing base (0bc91f3) to head (aec3364). :warning: Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3159      +/-   ##
==========================================
- Coverage   59.39%   55.64%   -3.75%     
==========================================
  Files         134      134              
  Lines       13514    13521       +7     
==========================================
- Hits         8026     7524     -502     
- Misses       4547     5062     +515     
+ Partials      941      935       -6     
Flag Coverage Δ
e2e-tests ?
integration-tests 54.66% <100.00%> (+1.63%) :arrow_up:
unit-tests 46.71% <100.00%> (-0.03%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Oct 29 '25 18:10 codecov[bot]

Hey @gauron99 I’m just curious, I only added one extra test case and a small validation check for empty credentials, but it seems a lot of E2E and integration tests started failing. My local make test passed successfully. Would love to understand this behavior better.

intojhanurag avatar Oct 29 '25 18:10 intojhanurag

helm installation is failing, unrelated; its failing everywhere

gauron99 avatar Oct 29 '25 19:10 gauron99

Haha, thank God, I thought I did something blunder 😅

intojhanurag avatar Oct 29 '25 20:10 intojhanurag

no worries, thats why we have tests to catch any possible "blunders" anyways... this case is not that though. its azure front door. We will rerun tests when the service seems up and running again

gauron99 avatar Oct 29 '25 20:10 gauron99

/retest

gauron99 avatar Oct 30 '25 17:10 gauron99

/retest

gauron99 avatar Nov 02 '25 20:11 gauron99

Hey @gauron99 , Is it good to go now ?

intojhanurag avatar Nov 04 '25 08:11 intojhanurag

you have some third party changes

gauron99 avatar Nov 04 '25 09:11 gauron99

you have some third party changes

Yeah , Due to "code styles" failure I ran the goimport -w . command in the repo .

intojhanurag avatar Nov 04 '25 13:11 intojhanurag

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: intojhanurag

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

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[bot] avatar Nov 05 '25 08:11 knative-prow[bot]