MCPcopy Index your code
hub / github.com/docker/cli / TestPluginMatch

Function TestPluginMatch

cli-plugins/manager/hooks_test.go:52–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestPluginMatch(t *testing.T) {
53 testCases := []struct {
54 doc string
55 commandString string
56 pluginConfig map[string]string
57 cmdErrorMessage string
58 expectedMatch string
59 expectedOk bool
60 }{
61 {
62 doc: "hooks prefix match",
63 commandString: "image ls",
64 pluginConfig: map[string]string{
65 "hooks": "image",
66 },
67 expectedMatch: "image",
68 expectedOk: true,
69 },
70 {
71 doc: "hooks no match",
72 commandString: "context ls",
73 pluginConfig: map[string]string{
74 "hooks": "build",
75 },
76 expectedMatch: "",
77 expectedOk: false,
78 },
79 {
80 doc: "hooks exact match",
81 commandString: "context ls",
82 pluginConfig: map[string]string{
83 "hooks": "context ls",
84 },
85 expectedMatch: "context ls",
86 expectedOk: true,
87 },
88 {
89 doc: "hooks first match wins",
90 commandString: "image ls",
91 pluginConfig: map[string]string{
92 "hooks": "image ls,image",
93 },
94 expectedMatch: "image ls",
95 expectedOk: true,
96 },
97 {
98 doc: "hooks empty string",
99 commandString: "image ls",
100 pluginConfig: map[string]string{
101 "hooks": "",
102 },
103 expectedMatch: "",
104 expectedOk: false,
105 },
106 {
107 doc: "hooks partial token no match",
108 commandString: "image inspect",
109 pluginConfig: map[string]string{

Callers

nothing calls this directly

Calls 1

pluginMatchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…