Skip to content

Commit 45bc430

Browse files
author
Maksym Pavlenko
authored
Merge pull request containerd#10294 from dmcgowan/fail-integration-test-on-plugin-fail
Fail integration test early when a plugin load fails
2 parents 34d3c17 + b1a23c4 commit 45bc430

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

integration/client/daemon.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ import (
2323
"io"
2424
"os/exec"
2525
"runtime"
26+
"strings"
2627
"sync"
2728
"syscall"
2829
"time"
2930

31+
"github.com/containerd/plugin"
32+
3033
. "github.com/containerd/containerd/v2/client"
3134
)
3235

@@ -79,6 +82,21 @@ func (d *daemon) waitForStart(ctx context.Context) (*Client, error) {
7982
}
8083
continue
8184
}
85+
resp, perr := client.IntrospectionService().Plugins(ctx)
86+
if perr != nil {
87+
return nil, fmt.Errorf("failed to get plugin list: %w", perr)
88+
}
89+
var loadErr error
90+
for _, p := range resp.Plugins {
91+
if p.InitErr != nil && !strings.Contains(p.InitErr.Message, plugin.ErrSkipPlugin.Error()) {
92+
pluginErr := fmt.Errorf("failed to load %s.%s: %s", p.Type, p.ID, p.InitErr.Message)
93+
loadErr = errors.Join(loadErr, pluginErr)
94+
}
95+
}
96+
if loadErr != nil {
97+
return nil, loadErr
98+
}
99+
82100
return client, err
83101
case <-ctx.Done():
84102
return nil, fmt.Errorf("context deadline exceeded: %w", err)

0 commit comments

Comments
 (0)