Skip to content

client: refactor ContainerTop to wrap options and results#51313

Merged
thaJeztah merged 1 commit intomoby:masterfrom
austinvazquez:refactor-client-container-top
Oct 29, 2025
Merged

client: refactor ContainerTop to wrap options and results#51313
thaJeztah merged 1 commit intomoby:masterfrom
austinvazquez:refactor-client-container-top

Conversation

@austinvazquez
Copy link
Contributor

- What I did
#50965

This change refactors the client implementation of ContainerTop to take client defined options and results to decouple future client development from API changes.

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the ContainerTop client method to use structured options and results types instead of raw parameters and API response types, aligning with the pattern used by other container operations and decoupling the client interface from API implementation details.

  • Introduces ContainerTopOptions struct to wrap the arguments parameter
  • Introduces ContainerTopResult struct to wrap the response data
  • Updates the ContainerTop method signature and all call sites to use the new types

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

File Description
client/container_top.go Defines new ContainerTopOptions and ContainerTopResult types and refactors ContainerTop to use them
client/client_interfaces.go Updates the ContainerAPIClient interface signature for ContainerTop
integration-cli/docker_api_containers_test.go Updates test calls to use the new ContainerTopOptions struct

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

we really need to find a replacement for this command that's better than "shell out to ps and pass arbitrary args"

@thaJeztah thaJeztah added this to the 29.0.0 milestone Oct 29, 2025
@thaJeztah thaJeztah merged commit 2bb019b into moby:master Oct 29, 2025
256 of 258 checks passed
@austinvazquez austinvazquez deleted the refactor-client-container-top branch October 29, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants