Merge pull request #10294 from dmcgowan/fail-integration-test-on-plugin-fail
Fail integration test early when a plugin load fails
This commit is contained in:
commit
45bc430dd1
@ -23,10 +23,13 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containerd/plugin"
|
||||||
|
|
||||||
. "github.com/containerd/containerd/v2/client"
|
. "github.com/containerd/containerd/v2/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,6 +82,21 @@ func (d *daemon) waitForStart(ctx context.Context) (*Client, error) {
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
resp, perr := client.IntrospectionService().Plugins(ctx)
|
||||||
|
if perr != nil {
|
||||||
|
return nil, fmt.Errorf("failed to get plugin list: %w", perr)
|
||||||
|
}
|
||||||
|
var loadErr error
|
||||||
|
for _, p := range resp.Plugins {
|
||||||
|
if p.InitErr != nil && !strings.Contains(p.InitErr.Message, plugin.ErrSkipPlugin.Error()) {
|
||||||
|
pluginErr := fmt.Errorf("failed to load %s.%s: %s", p.Type, p.ID, p.InitErr.Message)
|
||||||
|
loadErr = errors.Join(loadErr, pluginErr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if loadErr != nil {
|
||||||
|
return nil, loadErr
|
||||||
|
}
|
||||||
|
|
||||||
return client, err
|
return client, err
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil, fmt.Errorf("context deadline exceeded: %w", err)
|
return nil, fmt.Errorf("context deadline exceeded: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user