Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Add unit test for LoadAuth funciton in auth.go #1774

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

babugeet
Copy link
Contributor

@babugeet babugeet commented Jun 5, 2024

What this PR does / why we need it:

This PR adds unit test for LoadAuth funciton, mentioned in the issue #1574

Which issue(s) this PR fixes:
Fixes # #1574

The provided test cases cover the following scenarios for the LoadAuth function:

No Authentication Directory Exists:
    Test Case: NoAuthDirectory
    Description: Tests the scenario where the ironic authentication directory does not exist. The function should return NoAuth as the authentication type without any errors.

Valid Authentication Credentials:
    Test Case: ValidAuth
    Description: Tests the scenario where the ironic directory exists with valid username and password files. The function should return HTTPBasicAuth with the correct username and password.

Empty Username File:
    Test Case: EmptyUsername
    Description: Tests the scenario where the username file is present but empty. The function should return an error indicating that the HTTP Basic Auth username is empty.

Empty Password File:
    Test Case: EmptyPassword
    Description: Tests the scenario where the password file is present but empty. The function should return an error indicating that the HTTP Basic Auth password is empty.

@babugeet babugeet force-pushed the babugeet-patch-1 branch from 228736f to 936d116 Compare June 5, 2024 17:31
@babugeet babugeet closed this Jun 7, 2024
@babugeet babugeet reopened this Jun 7, 2024
@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 7, 2024
@babugeet
Copy link
Contributor Author

babugeet commented Jun 7, 2024

/cc @lentzi90 @kashifest

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

Thank you! The code looks good!
Could you please squash the commits?
/approve

/hold
(for squashing)

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2024
@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lentzi90

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

The pull request process is described 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

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 7, 2024
@babugeet babugeet force-pushed the babugeet-patch-1 branch from 936d116 to a53b825 Compare June 7, 2024 07:58
@metal3-io-bot metal3-io-bot added needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 7, 2024
@babugeet babugeet force-pushed the babugeet-patch-1 branch from a53b825 to 0e39b3d Compare June 7, 2024 08:01
@metal3-io-bot metal3-io-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 7, 2024
@babugeet
Copy link
Contributor Author

babugeet commented Jun 7, 2024

@lentzi90 : commits are squashed.
Pls check

@kashifest
Copy link
Member

/ok-to-test
@babugeet you need to fix DCO complain as well, just sign the commit with -S , check this section for reference.

@metal3-io-bot metal3-io-bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 7, 2024
@babugeet babugeet force-pushed the babugeet-patch-1 branch 5 times, most recently from 099c374 to aa5b24b Compare June 7, 2024 08:33
@babugeet
Copy link
Contributor Author

babugeet commented Jun 7, 2024

@kashifest : the DCO and the lint issues are solved.
Lint issue fix have added one more commit, do i need to squash that commit

@lentzi90
Copy link
Member

lentzi90 commented Jun 7, 2024

Yes please squash always

@kashifest
Copy link
Member

@kashifest : the DCO and the lint issues are solved. Lint issue fix have added one more commit, do i need to squash that commit

Thanks. ideally yes squashed with a proper commit message would be helpful

@babugeet babugeet force-pushed the babugeet-patch-1 branch from aa5b24b to 1b8d1d5 Compare June 7, 2024 08:45
@babugeet babugeet force-pushed the babugeet-patch-1 branch from 1b8d1d5 to 7767a23 Compare June 7, 2024 08:46
@babugeet
Copy link
Contributor Author

babugeet commented Jun 7, 2024

@lentzi90 , @kashifest : addressed all comments. Pls check

Copy link
Member

@kashifest kashifest left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2024
@kashifest
Copy link
Member

/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2024
@metal3-io-bot metal3-io-bot merged commit 12d4180 into metal3-io:main Jun 7, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants