MCPcopy Create free account
hub / github.com/zalando/skipper / Test_pluginFlag_Set

Function Test_pluginFlag_Set

config/pluginflags_test.go:13–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func Test_pluginFlag_Set(t *testing.T) {
14 tests := []struct {
15 name string
16 args string
17 wantErr bool
18 want [][]string
19 }{
20 {
21 name: "test plugin flag",
22 args: "geoip,db=/Users/test/test.mmdb",
23 wantErr: false,
24 want: [][]string{
25 {"geoip", "db=/Users/test/test.mmdb"},
26 },
27 },
28 {
29 name: "test plugin flag with two plugins",
30 args: "geoip,db=/Users/test/test.mmdb inet,timeout=1000,delay=2000",
31 wantErr: false,
32 want: [][]string{
33 {"geoip", "db=/Users/test/test.mmdb"},
34 {"inet", "timeout=1000", "delay=2000"},
35 },
36 },
37 }
38 for _, tt := range tests {
39 t.Run(tt.name, func(t *testing.T) {
40 pf := newPluginFlag()
41
42 if err := pf.Set(tt.args); (err != nil) != tt.wantErr {
43 t.Errorf("pluginFlag.Set() error = %v, wantErr %v", err, tt.wantErr)
44 }
45
46 if !tt.wantErr {
47 // sort lists because the order of pf.values is not guaranteed
48 sortFlags(pf.values)
49 sortFlags(tt.want)
50 if cmp.Equal(pf.values, tt.want) == false {
51 t.Errorf("pluginFlag.Set() got v, want v, %v", cmp.Diff(pf.values, tt.want))
52 }
53 }
54 })
55 }
56}
57
58func Test_pluginFlag_UnmarshalYAML(t *testing.T) {
59 tests := []struct {

Callers

nothing calls this directly

Calls 4

newPluginFlagFunction · 0.85
sortFlagsFunction · 0.85
SetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…