MCPcopy
hub / github.com/containerd/containerd / TestConfigureUnpackPlatforms

Function TestConfigureUnpackPlatforms

plugins/transfer/plugin_test.go:36–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34)
35
36func TestConfigureUnpackPlatforms(t *testing.T) {
37 tests := []struct {
38 name string
39 candidates []*plugin.Registration
40 config transferConfig
41 expectedErr error
42 expectedUnpackConfigs int
43 expectedApplier bool
44 }{
45 {
46 name: "optional explicit differ skip",
47 candidates: []*plugin.Registration{
48 newTestDiffPlugin("erofs", nil, plugin.ErrSkipPlugin, platforms.DefaultSpec()),
49 },
50 config: transferConfig{
51 UnpackConfiguration: []unpackConfiguration{
52 {
53 Platform: platforms.Format(platforms.DefaultSpec()),
54 Snapshotter: "native",
55 Differ: "erofs",
56 Optional: true,
57 },
58 },
59 },
60 },
61 {
62 name: "required explicit differ skip",
63 candidates: []*plugin.Registration{
64 newTestDiffPlugin("erofs", nil, plugin.ErrSkipPlugin, platforms.DefaultSpec()),
65 },
66 config: transferConfig{
67 UnpackConfiguration: []unpackConfiguration{
68 {
69 Platform: platforms.Format(platforms.DefaultSpec()),
70 Snapshotter: "native",
71 Differ: "erofs",
72 },
73 },
74 },
75 expectedErr: plugin.ErrSkipPlugin,
76 },
77 {
78 name: "optional explicit differ missing",
79 config: transferConfig{
80 UnpackConfiguration: []unpackConfiguration{
81 {
82 Platform: platforms.Format(platforms.DefaultSpec()),
83 Snapshotter: "native",
84 Differ: "missing",
85 Optional: true,
86 },
87 },
88 },
89 },
90 {
91 name: "auto differ skips unavailable candidate",
92 candidates: []*plugin.Registration{
93 newTestDiffPlugin("skipped", nil, plugin.ErrSkipPlugin, platforms.DefaultSpec()),

Callers

nothing calls this directly

Calls 5

newTestDiffPluginFunction · 0.85
newTestInitContextFunction · 0.85
configureUnpackPlatformsFunction · 0.85
FormatMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…