@@ -10,16 +10,16 @@ import (
10
10
)
11
11
12
12
func TestMatchObjectives (t * testing.T ) {
13
- o1 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" )}
14
- o2 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" , "ying" , "yang" )}
15
- o3 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" , "yes" , "no" )}
16
- o4 := slo.Objective {Labels : labels .FromStrings ("foo" , "baz" )}
13
+ obj1 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" )}
14
+ obj2 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" , "ying" , "yang" )}
15
+ obj3 := slo.Objective {Labels : labels .FromStrings ("foo" , "bar" , "yes" , "no" )}
16
+ obj4 := slo.Objective {Labels : labels .FromStrings ("foo" , "baz" )}
17
17
18
18
objectives := Objectives {objectives : map [string ]slo.Objective {}}
19
- objectives .Set (o1 )
20
- objectives .Set (o2 )
21
- objectives .Set (o3 )
22
- objectives .Set (o4 )
19
+ objectives .Set (obj1 )
20
+ objectives .Set (obj2 )
21
+ objectives .Set (obj3 )
22
+ objectives .Set (obj4 )
23
23
24
24
matches := objectives .Match ([]* labels.Matcher {
25
25
labels .MustNewMatcher (labels .MatchEqual , "foo" , "foo" ),
@@ -30,29 +30,29 @@ func TestMatchObjectives(t *testing.T) {
30
30
labels .MustNewMatcher (labels .MatchEqual , "foo" , "bar" ),
31
31
})
32
32
require .Len (t , matches , 3 )
33
- require .Contains (t , matches , o1 )
34
- require .Contains (t , matches , o2 )
35
- require .Contains (t , matches , o3 )
33
+ require .Contains (t , matches , obj1 )
34
+ require .Contains (t , matches , obj2 )
35
+ require .Contains (t , matches , obj3 )
36
36
37
37
matches = objectives .Match ([]* labels.Matcher {
38
38
labels .MustNewMatcher (labels .MatchEqual , "foo" , "baz" ),
39
39
})
40
40
require .Len (t , matches , 1 )
41
- require .Contains (t , matches , o4 )
41
+ require .Contains (t , matches , obj4 )
42
42
43
43
matches = objectives .Match ([]* labels.Matcher {
44
44
labels .MustNewMatcher (labels .MatchEqual , "foo" , "bar" ),
45
45
labels .MustNewMatcher (labels .MatchEqual , "ying" , "yang" ),
46
46
})
47
47
require .Len (t , matches , 1 )
48
- require .Contains (t , matches , o2 )
48
+ require .Contains (t , matches , obj2 )
49
49
50
50
matches = objectives .Match ([]* labels.Matcher {
51
51
labels .MustNewMatcher (labels .MatchRegexp , "foo" , "ba." ),
52
52
})
53
53
require .Len (t , matches , 4 )
54
- require .Contains (t , matches , o1 )
55
- require .Contains (t , matches , o2 )
56
- require .Contains (t , matches , o3 )
57
- require .Contains (t , matches , o4 )
54
+ require .Contains (t , matches , obj1 )
55
+ require .Contains (t , matches , obj2 )
56
+ require .Contains (t , matches , obj3 )
57
+ require .Contains (t , matches , obj4 )
58
58
}
0 commit comments