diff --git a/lib/aerospike/command/command.rb b/lib/aerospike/command/command.rb index 03da4bc..58a4334 100644 --- a/lib/aerospike/command/command.rb +++ b/lib/aerospike/command/command.rb @@ -633,7 +633,8 @@ def set_query(cluster, policy, statement, background, node_partitions) if statement.function_name write_field_header(1, FieldType::UDF_OP) - @data_offset += @data_buffer.write_byte(1, @data_offset) + ret_marker = statement.return_data ? 1 : 2 + @data_offset += @data_buffer.write_byte(ret_marker, @data_offset) write_field_string(statement.package_name, FieldType::UDF_PACKAGE_NAME) write_field_string(statement.function_name, FieldType::UDF_FUNCTION) write_field_string(function_arg_buffer, FieldType::UDF_ARGLIST) diff --git a/spec/aerospike/scan_spec.rb b/spec/aerospike/scan_spec.rb index 3d02b4d..eb7f5f1 100644 --- a/spec/aerospike/scan_spec.rb +++ b/spec/aerospike/scan_spec.rb @@ -23,7 +23,7 @@ let(:client) { Support.client } before :all do - @namespace = "test" + @namespace = Support.namespace @set = "scan1000" @record_count = 1000 @record_count.times do |i| @@ -31,8 +31,8 @@ bin_map = { 'bin1' => "value#{i}", 'bin2' => i, - 'bin4' => ['value4', {'map1' => 'map val'}], - 'bin5' => {'value5' => [124, "string value"]}, + 'bin4' => ['value4', { 'map1' => 'map val' }], + 'bin5' => { 'value5' => [124, "string value"] } } Support.client.put(key, bin_map, :send_key => true) end @@ -53,7 +53,7 @@ def scan_method(type, compressed, bin_names=[], ops={}) [true, false].each do |compressed| [:single_node, :multiple_nodes].each do |type| - context "#{type.to_s}" do + context "#{type}" do it "should return all records with all bins" do rs_list = scan_method(type, compressed, nil, :record_queue_size => 10) @@ -94,7 +94,7 @@ def scan_method(type, compressed, bin_names=[], ops={}) end # it it "should return only the selected bins" do - rs_list = scan_method(type, compressed, ['bin1', 'bin2'], :record_queue_size => 10) + rs_list = scan_method(type, compressed, %w[bin1 bin2], :record_queue_size => 10) count = 0 rs_list.each do |rs| @@ -127,14 +127,14 @@ def scan_method(type, compressed, bin_names=[], ops={}) rs_list.each do |rs| sleep(1) # fill the queue to make sure deadlock doesn't happen rs.cancel - expect {rs.next_record}.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) + expect { rs.next_record }.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) end rs_list = scan_method(type, compressed) rs_list.each do |rs| rs = rs_list.first rs.cancel - expect {rs.next_record}.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) + expect { rs.next_record }.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) end end # it @@ -146,12 +146,12 @@ def scan_method(type, compressed, bin_names=[], ops={}) i = 0 rs.each do |rec| i +=1 - break if (i == 15) + break if i == 15 end expect(i).to eq 15 rs.cancel - expect {rs.next_record}.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) + expect { rs.next_record }.to raise_exception(Aerospike::ResultCode.message(Aerospike::ResultCode::SCAN_TERMINATED)) end end # it diff --git a/spec/aerospike/udf_spec.rb b/spec/aerospike/udf_spec.rb index ca6dfff..90af6e5 100644 --- a/spec/aerospike/udf_spec.rb +++ b/spec/aerospike/udf_spec.rb @@ -145,14 +145,14 @@ end it "should execute a UDF on all records" do - ns = 'test' + ns = Support.namespace set = Support.rand_string(10) div = 2 number_of_records = 100 - number_of_records.times do |i| + number_of_records.times do key = Support.gen_random_key(50, { :set => set }) - bin1 = Aerospike::Bin.new('bin1', (i + 1) * div) + bin1 = Aerospike::Bin.new('bin1', div) bin2 = Aerospike::Bin.new('bin2', -1) client.put(key, [bin1, bin2]) end