Skip to content

Commit 7f0d4a3

Browse files
committed
not entirely sure why all this jruby contortions were happening?
Making everything work like MRI fixed a bunch of test failures...
1 parent 5ae639c commit 7f0d4a3

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ if jruby?
3131
ext.name = "native"
3232
ext.ext_dir = "src"
3333
ext.lib_dir = "lib/mongo/auth/kerberos"
34+
ext.release = ENV['JAVA_RELEASE'].to_i if ENV['JAVA_RELEASE']
3435
end
3536
else
3637
require "rake/extensiontask"

lib/mongo/auth/kerberos/conversation.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,12 @@ def initialize(user, host)
127127

128128
private
129129

130-
if BSON::Environment.jruby?
131-
132-
def start_token
133-
BSON::Binary.new(authenticator.initialize_challenge)
134-
end
135-
136-
def continue_token
137-
payload = reply.documents[0][PAYLOAD]
138-
BSON::Binary.new(authenticator.evaluate_challenge(payload.data))
139-
end
140-
else
141-
142-
def start_token
143-
authenticator.initialize_challenge
144-
end
130+
def start_token
131+
authenticator.initialize_challenge
132+
end
145133

146-
def continue_token
147-
authenticator.evaluate_challenge(reply.documents[0][PAYLOAD])
148-
end
134+
def continue_token
135+
authenticator.evaluate_challenge(reply.documents[0][PAYLOAD])
149136
end
150137

151138
def validate!(reply)

spec/mongo/auth/kerberos/conversation_spec.rb

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@
5757
expect(selector[:mechanism]).to eq('GSSAPI')
5858
end
5959

60-
it 'sets the payload', unless: BSON::Environment.jruby? do
60+
it 'sets the payload' do
6161
expect(selector[:payload]).to start_with('test')
6262
end
63-
64-
it 'sets the payload', if: BSON::Environment.jruby? do
65-
expect(selector[:payload].data).to start_with('test')
66-
end
6763
end
6864

6965
describe '#finalize' do
@@ -72,8 +68,10 @@
7268
Mongo::Protocol::Reply.new
7369
end
7470

71+
let(:continue_token_contents) { 'testing' }
72+
7573
let(:continue_token) do
76-
BSON::Environment.jruby? ? BSON::Binary.new('testing') : 'testing'
74+
continue_token_contents
7775
end
7876

7977
context 'when the conversation is a success' do
@@ -82,7 +80,7 @@
8280
[{
8381
'conversationId' => 1,
8482
'done' => false,
85-
'payload' => continue_token,
83+
'payload' => continue_token_contents,
8684
'ok' => 1.0
8785
}]
8886
end
@@ -97,22 +95,18 @@
9795

9896
before do
9997
expect(authenticator).to receive(:evaluate_challenge).
100-
with('testing').and_return(continue_token)
98+
with(continue_token_contents).and_return(continue_token_contents)
10199
reply.instance_variable_set(:@documents, documents)
102100
end
103101

104102
it 'sets the conversation id' do
105103
expect(selector[:conversationId]).to eq(1)
106104
end
107105

108-
it 'sets the payload', unless: BSON::Environment.jruby? do
106+
it 'sets the payload' do
109107
expect(selector[:payload]).to eq(continue_token)
110108
end
111109

112-
it 'sets the payload', if: BSON::Environment.jruby? do
113-
expect(selector[:payload].data).to eq(continue_token)
114-
end
115-
116110
it 'sets the continue flag' do
117111
expect(selector[:saslContinue]).to eq(1)
118112
end

0 commit comments

Comments
 (0)