Skip to content

🌱 Add unit tests for getDiskType, getStorageDetails, getCPUDetails, getSystemVendorDetails#3150

Open
archy-rock3t-cloud wants to merge 1 commit intometal3-io:mainfrom
sophotechlabs:test/hardwaredetails-coverage
Open

🌱 Add unit tests for getDiskType, getStorageDetails, getCPUDetails, getSystemVendorDetails#3150
archy-rock3t-cloud wants to merge 1 commit intometal3-io:mainfrom
sophotechlabs:test/hardwaredetails-coverage

Conversation

@archy-rock3t-cloud
Copy link
Copy Markdown

What this PR does / why we need it:

Add unit tests for getDiskType, getStorageDetails, getCPUDetails, getSystemVendorDetails

Checklist:

  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • E2E tests have been added, if necessary.
  • Integration tests have been added, if necessary.

…etSystemVendorDetails

Signed-off-by: Artem Muterko <artem@sopho.tech>
@metal3-io-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kashifest for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@metal3-io-bot metal3-io-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 9, 2026
@metal3-io-bot
Copy link
Copy Markdown
Contributor

Hi @archy-rock3t-cloud. Thanks for your PR.

I'm waiting for a metal3-io 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.

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 9, 2026
Copy link
Copy Markdown
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

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

/ok-to-test

Thanks! Could we address some edge cases more?

  1. getcpudetails invalid/empty frequency string
  2. nil input to getcpudetails
  3. nil input for getstoragedetails
  4. getstoragedetails with empty name but non-empty path

Comment on lines +301 to +304
assert.Equal(t, metal3api.HDD, getDiskType(inventory.RootDiskType{Rotational: true}))
assert.Equal(t, metal3api.NVME, getDiskType(inventory.RootDiskType{Name: "/dev/nvme0n1"}))
assert.Equal(t, metal3api.NVME, getDiskType(inventory.RootDiskType{Name: "/dev/nvme0n1p1"}))
assert.Equal(t, metal3api.SSD, getDiskType(inventory.RootDiskType{Name: "/dev/sda"}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Convert to table-driven test.

@metal3-io-bot metal3-io-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants