File tree Expand file tree Collapse file tree 1 file changed +42
-3
lines changed
elasticsearch-transport/spec/elasticsearch/transport Expand file tree Collapse file tree 1 file changed +42
-3
lines changed Original file line number Diff line number Diff line change 65
65
}
66
66
end
67
67
68
- it_behaves_like 'a redacted string'
68
+ if jruby?
69
+ let ( :client ) { Elasticsearch ::Transport ::Client . new ( arguments ) }
70
+ let ( :logger ) { double ( 'logger' , fatal? : true , fatal : '' ) }
71
+
72
+ it 'does not include the password in the logged string' do
73
+ expect ( logger ) . not_to receive ( :fatal ) . with ( /secret_password/ )
74
+
75
+ expect {
76
+ client . cluster . stats
77
+ } . to raise_exception ( Faraday ::SSLError )
78
+ end
79
+
80
+ it 'replaces the password with the string \'REDACTED\'' do
81
+ expect ( logger ) . to receive ( :fatal ) . with ( /REDACTED/ )
82
+ expect {
83
+ client . cluster . stats
84
+ } . to raise_exception ( Faraday ::SSLError )
85
+ end
86
+ else
87
+ it_behaves_like 'a redacted string'
88
+ end
69
89
end
70
90
71
91
context 'when the user and password are provided in the URI object' do
75
95
logger : logger
76
96
}
77
97
end
78
-
79
- it_behaves_like 'a redacted string'
98
+ if jruby?
99
+ let ( :client ) { Elasticsearch ::Transport ::Client . new ( arguments ) }
100
+ let ( :logger ) { double ( 'logger' , fatal? : true , fatal : '' ) }
101
+
102
+ it 'does not include the password in the logged string' do
103
+ expect ( logger ) . not_to receive ( :fatal ) . with ( /secret_password/ )
104
+
105
+ expect {
106
+ client . cluster . stats
107
+ } . to raise_exception ( Faraday ::SSLError )
108
+ end
109
+
110
+ it 'replaces the password with the string \'REDACTED\'' do
111
+ expect ( logger ) . to receive ( :fatal ) . with ( /REDACTED/ )
112
+ expect {
113
+ client . cluster . stats
114
+ } . to raise_exception ( Faraday ::SSLError )
115
+ end
116
+ else
117
+ it_behaves_like 'a redacted string'
118
+ end
80
119
end
81
120
end
82
121
You can’t perform that action at this time.
0 commit comments