Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(agent/agentcontainers): refactor Lister to ContainerCLI and implement new methods#18243

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 65 additions & 16 deletionsagent/agentcontainers/acmock/acmock.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionagent/agentcontainers/acmock/doc.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
// Package acmock contains a mock implementation of agentcontainers.Lister for use in tests.
package acmock

//go:generate mockgen -destination ./acmock.go -package acmock ..Lister,DevcontainerCLI
//go:generate mockgen -destination ./acmock.go -package acmock ..ContainerCLI,DevcontainerCLI
16 changes: 8 additions & 8 deletionsagent/agentcontainers/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ type API struct {
logger slog.Logger
watcher watcher.Watcher
execer agentexec.Execer
cl Lister
ccliContainerCLI
dccli DevcontainerCLI
clock quartz.Clock
scriptLogger func(logSourceID uuid.UUID) ScriptLogger
Expand DownExpand Up@@ -80,11 +80,11 @@ func WithExecer(execer agentexec.Execer) Option {
}
}

//WithLister sets the agentcontainers.Lister implementation to use.
// The default implementation uses the Docker CLI to list containers.
funcWithLister(cl Lister) Option {
//WithContainerCLI sets the agentcontainers.ContainerCLI implementation
//to use.The default implementation uses the Docker CLI.
funcWithContainerCLI(ccli ContainerCLI) Option {
return func(api *API) {
api.cl =cl
api.ccli =ccli
}
}

Expand DownExpand Up@@ -186,8 +186,8 @@ func NewAPI(logger slog.Logger, options ...Option) *API {
for _, opt := range options {
opt(api)
}
if api.cl == nil {
api.cl =NewDocker(api.execer)
if api.ccli == nil {
api.ccli =NewDockerCLI(api.execer)
}
if api.dccli == nil {
api.dccli = NewDevcontainerCLI(logger.Named("devcontainer-cli"), api.execer)
Expand DownExpand Up@@ -363,7 +363,7 @@ func (api *API) updateContainers(ctx context.Context) error {
listCtx, listCancel := context.WithTimeout(ctx, listContainersTimeout)
defer listCancel()

updated, err := api.cl.List(listCtx)
updated, err := api.ccli.List(listCtx)
if err != nil {
// If the context was canceled, we hold off on clearing the
// containers cache. This is to avoid clearing the cache if
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp