File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ def load_group(group_entry)
147
147
#
148
148
# Returns an Array of Net::LDAP::Entry.
149
149
def search ( options , &block )
150
- instrument "github_ldap. search" , options . dup do |payload |
150
+ instrument "search.github_ldap " , options . dup do |payload |
151
151
result =
152
152
if options [ :base ]
153
153
@connection . search ( options , &block )
Original file line number Diff line number Diff line change @@ -65,6 +65,18 @@ def test_search_domains
65
65
refute result . empty?
66
66
assert_equal 'calavera' , result . first [ :uid ] . first
67
67
end
68
+
69
+ def test_instruments_search
70
+ events = @service . subscribe "search.github_ldap"
71
+ result = @ldap . search ( filter : "(uid=calavera)" , :base => "dc=github,dc=com" )
72
+ refute_predicate result , :empty?
73
+ payload , event_result = events . pop
74
+ assert payload
75
+ assert event_result
76
+ assert_equal result , event_result
77
+ assert_equal "(uid=calavera)" , payload [ :filter ] . to_s
78
+ assert_equal "dc=github,dc=com" , payload [ :base ]
79
+ end
68
80
end
69
81
70
82
class GitHubLdapTest < GitHub ::Ldap ::Test
Original file line number Diff line number Diff line change @@ -29,9 +29,11 @@ def self.start_server
29
29
end
30
30
31
31
def options
32
+ @service = MockInstrumentationService . new
32
33
@options ||= GitHub ::Ldap . server_options . merge \
33
34
host : 'localhost' ,
34
- uid : 'uid'
35
+ uid : 'uid' ,
36
+ :instrumentation_service => @service
35
37
end
36
38
end
37
39
You can’t perform that action at this time.
0 commit comments