Skip to content

feat: enhance SMD client with membership listing and improve tests for node population - #123

Merged
travisbcotton merged 2 commits into
mainfrom
refactor/smd-cache-refactor
Aug 3, 2026
Merged

feat: enhance SMD client with membership listing and improve tests for node population#123
travisbcotton merged 2 commits into
mainfrom
refactor/smd-cache-refactor

Conversation

@alexlovelltroy

Copy link
Copy Markdown
Member

Description

This pull request refactors how group membership data is fetched and handled for nodes in the SMD client, switching from per-node membership API calls to a bulk query. This change improves efficiency by reducing the number of HTTP requests during node population. The update also includes adjustments to tests and the fake client to support and verify the new bulk membership fetching logic.

The most important changes are:

Efficiency and Logic Improvements:

  • SMDclient.go: Changed group membership fetching in PopulateNodes from making individual requests per node to a single bulk /hsm/v2/memberships?type=node call, reducing HTTP overhead and improving performance.
  • SMDclient_test.go, SMDclient_performance_test.go: Updated all tests and test servers to expect and handle bulk membership requests instead of per-node requests, ensuring test coverage for the new logic. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Testing and Validation:

  • SMDclient_test.go: Added assertions to verify that only the bulk membership endpoint is called and that no per-node membership requests are made during node population.
  • SMDclient_performance_test.go: Added a helper function bulkMembershipsJSON to generate bulk membership responses for tests and benchmarks, supporting scalable test scenarios.

Fake Client Enhancements:

  • FakeSMDClient.go, FakeSMDClient_test.go: Added a ListMemberships method to the fake client to simulate the new bulk membership API, and introduced corresponding tests to validate its behavior. [1] [2]

These changes collectively modernize and streamline group membership handling, improving both runtime efficiency and test reliability.

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • I have updated the relevant documentation (CLI examples, man pages, README, other docs, etc.)
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar
    • All referenced licenses are present in the LICENSES/ directory

Type of Change

  • Refactor
  • [/] Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Dependency update

For more info, see Contributing Guidelines.

…r node population

Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
…mance tests

Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>

@travisbcotton travisbcotton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@travisbcotton
travisbcotton merged commit a5bc725 into main Aug 3, 2026
6 checks passed
@synackd
synackd deleted the refactor/smd-cache-refactor branch August 4, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants