metal3-io / baremetal-operator

Bare metal host provisioning integration for Kubernetes
Apache License 2.0
551 stars 241 forks source link

Unit test coverage improvement in BMO #1574

Open lentzi90 opened 4 months ago

lentzi90 commented 4 months ago

Improve the unit test coverage by writing new test cases or completely new tests. Check the current coverage with make unit-cover.

Here are some suggestions on where to start. Note that some functions are harder to test than others because they may depend on access to network resources or a database. If you come across such function, skip them and aim for the low hanging fruits instead.

lentzi90 commented 4 months ago

/triage accepted /good-first-issue

metal3-io-bot commented 4 months ago

@lentzi90: This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/metal3-io/baremetal-operator/issues/1574): >/triage accepted >/good-first-issue Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
lentzi90 commented 4 months ago

/reopen

metal3-io-bot commented 4 months ago

@lentzi90: Reopened this issue.

In response to [this](https://github.com/metal3-io/baremetal-operator/issues/1574#issuecomment-1980165151): >/reopen Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
NeerajNagure commented 4 months ago

/assign NeerajNagure

lentzi90 commented 1 month ago

/reopen There are a few items in the list still

metal3-io-bot commented 1 month ago

@lentzi90: Reopened this issue.

In response to [this](https://github.com/metal3-io/baremetal-operator/issues/1574#issuecomment-2128632174): >/reopen >There are a few items in the list still Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
babugeet commented 1 month ago

@lentzi90 : can i take it up for adding test cases for LoadAuth

lentzi90 commented 1 month ago

Sure! Go ahead @babugeet ! :slightly_smiling_face:

babugeet commented 1 month ago

/assign babugeet @lentzi90 : pls review the above PR

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.