MCPcopy Create free account
hub / github.com/containerd/nerdctl / RequireContainerdPlugin

Function RequireContainerdPlugin

pkg/testutil/testutil.go:620–646  ·  view source on GitHub ↗
(base *Base, requiredType, requiredID string, requiredCaps []string)

Source from the content-addressed store, hash-verified

618}
619
620func RequireContainerdPlugin(base *Base, requiredType, requiredID string, requiredCaps []string) {
621 base.T.Helper()
622 info := base.InfoNative()
623 for _, p := range info.Daemon.Plugins.Plugins {
624 if p.Type != requiredType {
625 continue
626 }
627 if p.ID != requiredID {
628 continue
629 }
630 pCapMap := make(map[string]struct{}, len(p.Capabilities))
631 for _, f := range p.Capabilities {
632 pCapMap[f] = struct{}{}
633 }
634 for _, f := range requiredCaps {
635 if _, ok := pCapMap[f]; !ok {
636 base.T.Skipf("test requires containerd plugin \"%s.%s\" with capabilities %v (missing %q)", requiredType, requiredID, requiredCaps, f)
637 }
638 }
639 return
640 }
641 if len(requiredCaps) == 0 {
642 base.T.Skipf("test requires containerd plugin \"%s.%s\"", requiredType, requiredID)
643 } else {
644 base.T.Skipf("test requires containerd plugin \"%s.%s\" with capabilities %v", requiredType, requiredID, requiredCaps)
645 }
646}
647
648func RequireSystemService(t testing.TB, sv string) {
649 t.Helper()

Callers

nothing calls this directly

Calls 2

InfoNativeMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…