(t *testing.T)
| 34 | ) |
| 35 | |
| 36 | func 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()), |
nothing calls this directly
no test coverage detected
searching dependent graphs…