Bumped patch version. Added more mongo-qa tests.

This commit is contained in:
Jim Menard 2009-02-05 14:24:59 -05:00
parent 8ef393437c
commit 0c89a036d1
7 changed files with 95 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'mongo'
s.version = '0.5.2'
s.version = '0.5.3'
s.platform = Gem::Platform::RUBY
s.summary = 'Simple pure-Ruby driver for the 10gen Mongo DB'
s.description = 'A pure-Ruby driver for the 10gen Mongo DB. For more information about Mongo, see http://www.mongodb.org.'

22
tests/mongo-qa/admin Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
db.collection('test').insert({'test' => 1})
admin = db.admin
['test', 'pdlskwmf', '$'].each { |name|
begin
admin.validate_collection(name)
puts 'true'
rescue => ex
puts 'false'
end
}
level_xlation = {:off => 'off', :all => 'all', :slow_only => 'slowOnly'}
puts level_xlation[admin.profiling_level]
admin.profiling_level = :off
puts level_xlation[admin.profiling_level]

17
tests/mongo-qa/dberror Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
db.create_collection('capped1', :capped => true, :size => 500)
coll = db.collection('capped1')
coll.insert('x' => 1)
coll.insert('x' => 2)
db.create_collection('capped2', :capped => true, :size => 1000, :max => 11)
coll = db.collection('capped2')
str = ''
100.times {
coll.insert('dashes' => str)
str << '-'
}

7
tests/mongo-qa/find1 Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
cursor = db.collection('c').find({'x' => 1}, :sort => 'y', :offset => 20, :limit => 10)
cursor.each { |row| puts row['z'] }

17
tests/mongo-qa/indices Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
x = db.collection('x')
y = db.collection('y')
def print_sorted_info_keys(info)
puts info[:keys].keys.sort.collect { |key| "#{key}_1" }.join("_")
end
x.drop_index('field1')
x.index_information.each { |info| print_sorted_info_keys(info) }
y.create_index('abc', ['a', 'b', 'c'])
y.create_index('d', ['d'])
y.index_information.sort{|a,b| a[:name] <=> b[:name]}.each { |info| print_sorted_info_keys(info) }

22
tests/mongo-qa/stress1 Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ruby
LONG_STRING = "lksjhasoh1298alshasoidiohaskjasiouashoasasiugoas" * 6
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
c = db.collection('stress1')
50000.times { |i|
c.insert(:name => "asdf#{i}", :date => Time.now, :_id => i,
:blah => LONG_STRING, :subarray => [])
}
puts
10000.times { |i|
cursor = c.find({:_id => i})
x = cursor.next_object
cursor.close
x['subarray'] = "foo#{i}"
c.insert(x)
}
puts

9
tests/mongo-qa/update Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '_common.rb')
db = Mongo.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
foo = db.collection('foo')
foo.update({:x => 1}, {:x => 1, :y => 2})
foo.update({:x => 2}, {:x => 1, :y => 7})
foo.update({:x => 3}, {:x => 4, :y => 1})