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

Function ContainerdVersion

pkg/testutil/nerdtest/requirements.go:527–546  ·  view source on GitHub ↗
(v string)

Source from the content-addressed store, hash-verified

525}
526
527func ContainerdVersion(v string) *test.Requirement {
528 return &test.Requirement{
529 Check: func(data test.Data, helpers test.Helpers) (bool, string) {
530 ctx := context.Background()
531 namespace := defaultNamespace
532 address := defaults.DefaultAddress
533 client, ctx, cancel, err := clientutil.NewClient(ctx, namespace, address)
534 if err != nil {
535 return false, fmt.Sprintf("failed to create client: %v", err)
536 }
537 defer cancel()
538 if sv, err := containerdutil.ServerSemVer(ctx, client); err != nil {
539 return false, err.Error()
540 } else if sv.LessThan(semver.MustParse(v)) {
541 return false, fmt.Sprintf("`nerdctl commit --compression expects containerd %s or later, got containerd %v", v, sv)
542 }
543 return true, ""
544 },
545 }
546}
547
548// CNIFirewallVersion checks if the CNI firewall plugin version is greater than or equal to the specified version
549func CNIFirewallVersion(requiredVersion string) *test.Requirement {

Callers 1

TestZstdCommitFunction · 0.92

Calls 4

NewClientFunction · 0.92
ServerSemVerFunction · 0.92
BackgroundMethod · 0.65
ErrorMethod · 0.45

Tested by 1

TestZstdCommitFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…