MCPcopy Create free account
hub / github.com/docker/secrets-engine / TestMatchNew

Function TestMatchNew

x/secrets/identifiers_test.go:59–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestMatchNew(t *testing.T) {
60 tests := []struct {
61 pattern string
62 ids []string
63 expected bool
64 }{
65 {
66 pattern: "*/**/*",
67 ids: []string{"foo/bar", "foo/bar/baz"},
68 expected: true,
69 },
70 {
71 pattern: "**",
72 ids: []string{"foo", "foo/bar", "foo/bar/baz"},
73 expected: true,
74 },
75 {
76 pattern: "foo/bar",
77 ids: []string{"foo/bar/baz", "foo"},
78 expected: false,
79 },
80 {
81 pattern: "foo/*",
82 ids: []string{"foo/bar"},
83 expected: true,
84 },
85 {
86 pattern: "foo/*",
87 ids: []string{"foo/bar/baz", "foo"},
88 expected: false,
89 },
90 {
91 pattern: "*/bar",
92 ids: []string{"foo/bar"},
93 expected: true,
94 },
95 {
96 pattern: "*/bar",
97 ids: []string{"foo/bar/baz", "foo"},
98 expected: false,
99 },
100 {
101 pattern: "foo/**/baz",
102 ids: []string{"foo/bar/baz", "foo/baz", "foo/bar/something/baz"},
103 expected: true,
104 },
105 {
106 pattern: "foo/**/baz",
107 ids: []string{"foo/bar", "foo/bar/baz/qux"},
108 expected: false,
109 },
110 {
111 pattern: "com.test.test/**",
112 ids: []string{"com.test.test/test/bob", "com.test.test/test/alice"},
113 expected: true,
114 },
115 {
116 pattern: "foo/127.0.0.1:8080/**",

Callers

nothing calls this directly

Calls 4

ParseIDFunction · 0.85
ParsePatternFunction · 0.85
RunMethod · 0.65
MatchMethod · 0.65

Tested by

no test coverage detected