...
1
16
17 package driver
18
19 import (
20 "testing"
21 )
22
23 func TestLabelsMatch(t *testing.T) {
24 var tests = []struct {
25 desc string
26 set1 labels
27 set2 labels
28 expect bool
29 }{
30 {
31 "equal labels sets",
32 labels(map[string]string{"KEY_A": "VAL_A", "KEY_B": "VAL_B"}),
33 labels(map[string]string{"KEY_A": "VAL_A", "KEY_B": "VAL_B"}),
34 true,
35 },
36 {
37 "disjoint label sets",
38 labels(map[string]string{"KEY_C": "VAL_C", "KEY_D": "VAL_D"}),
39 labels(map[string]string{"KEY_A": "VAL_A", "KEY_B": "VAL_B"}),
40 false,
41 },
42 }
43
44 for _, tt := range tests {
45 if !tt.set1.match(tt.set2) && tt.expect {
46 t.Fatalf("Expected match '%s'\n", tt.desc)
47 }
48 }
49 }
50
View as plain text