removed old mongo-qa tests
This commit is contained in:
parent
2310a878ea
commit
990c00b261
@ -1,8 +0,0 @@
|
||||
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '../..', 'lib')
|
||||
require 'mongo'
|
||||
|
||||
DEFAULT_HOST = '127.0.0.1'
|
||||
DEFAULT_PORT = 27017
|
||||
DEFAULT_DB = 'driver_test_framework'
|
||||
|
||||
include Mongo
|
@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
db.collection('test').insert({'test' => 1})
|
||||
admin = db.admin
|
||||
|
||||
if $DEBUG
|
||||
db.drop_collection('tester')
|
||||
admin.profiling_level = :slow_only
|
||||
end
|
||||
|
||||
['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]
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
db.drop_collection('capped1')
|
||||
db.drop_collection('capped2')
|
||||
end
|
||||
|
||||
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 << '-'
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
3.times { |i| db.drop_collection("test#{i+1}") }
|
||||
db.create_collection('test1')
|
||||
db.collection('test2').insert({:name => 'a'})
|
||||
c = db.collection('test3')
|
||||
100.times { |i| c.insert(:i => i, :foo => 'bar') }
|
||||
end
|
||||
|
||||
puts db.collection('test1').count
|
||||
puts db.collection('test2').count
|
||||
puts db.collection('test3').find('i' => 'a').count
|
||||
puts db.collection('test3').find('i' => 3).count
|
||||
puts db.collection('test3').find({'i' => {'$gte' => 67}}).count
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
3.times { |i| db.drop_collection("dbs_#{i+1}") }
|
||||
end
|
||||
|
||||
def print_dbs_names(db)
|
||||
db.collection_names.select{ |n| n =~ /\.dbs/ }.sort.each { |name|
|
||||
puts name.sub(/^#{db.name}\./, '')
|
||||
}
|
||||
end
|
||||
|
||||
db.collection('dbs_1').insert('foo' => 'bar')
|
||||
db.collection('dbs_2').insert('psi' => 'phi')
|
||||
puts db.name
|
||||
print_dbs_names(db)
|
||||
db.drop_collection('dbs_1')
|
||||
db.create_collection('dbs_3')
|
||||
print_dbs_names(db)
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
db.drop_collection('test')
|
||||
end
|
||||
|
||||
db.collection('test').insert('a' => 2)
|
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
db.drop_collection('c')
|
||||
c = db.collection('c')
|
||||
(5..15).each { |i| c.insert(:x => 0, :y => i, :z => (i+64).chr) }
|
||||
(1..50).each { |i| c.insert(:x => 1, :y => i, :z => (i+64).chr) }
|
||||
(5..15).each { |i| c.insert(:x => 2, :y => i, :z => (i+64).chr) }
|
||||
end
|
||||
|
||||
cursor = db.collection('c').find({'x' => 1}, :sort => 'y', :skip => 20, :limit => 10)
|
||||
cursor.each { |row| puts row['z'] }
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
require 'mongo/gridfs'
|
||||
include GridFS
|
||||
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
input_file = ARGV[0]
|
||||
|
||||
File.open(input_file, "r") { |f|
|
||||
GridStore.open(db, input_file, "w") { |g|
|
||||
g.write(f.read)
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
require 'mongo/gridfs'
|
||||
include GridFS
|
||||
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
input_file = ARGV[0]
|
||||
output_file = ARGV[1]
|
||||
|
||||
File.open(output_file, "w") { |f|
|
||||
GridStore.open(db, input_file, "r") { |g|
|
||||
f.write(g.read)
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
|
||||
include Mongo
|
||||
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
x = db.collection('x')
|
||||
y = db.collection('y')
|
||||
|
||||
def sorted_index_info(c)
|
||||
c.index_information.sort { |a,b| a[:name] <=> b[:name] }
|
||||
end
|
||||
|
||||
def sorted_info_keys(info)
|
||||
info[:keys].keys.sort.collect { |key| "#{key}_1" }.join("_")
|
||||
end
|
||||
|
||||
def check_keys(c, expected)
|
||||
keys = sorted_index_info(c).collect {|info| sorted_info_keys(info)}
|
||||
if keys == expected
|
||||
''
|
||||
else
|
||||
"#{c.name} indices should start out #{expected.inspect} but is #{keys.inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
if $DEBUG
|
||||
x.drop # also drops indexes
|
||||
x.insert('field1' => 'f1', 'field2' => 'f2')
|
||||
x.create_index('field1_1', 'field1')
|
||||
x.create_index('field2_1', 'field2')
|
||||
y.drop
|
||||
end
|
||||
|
||||
# There should only be two indices on x, and none on y. We raise an error if
|
||||
# the preconditions are not met. (They were not, on our testing harness, for a
|
||||
# while due to Mongo behavior.)
|
||||
err = []
|
||||
err << check_keys(x, ['field1_1', 'field2_1'])
|
||||
err << check_keys(y, [])
|
||||
raise "\n#{err.join("\n")}" unless err == ['', '']
|
||||
|
||||
x.drop_index('field1_1')
|
||||
sorted_index_info(x).each { |info| puts sorted_info_keys(info) }
|
||||
|
||||
y.create_index([['a', ASCENDING], ['b', ASCENDING], ['c', ASCENDING]])
|
||||
y.create_index('d')
|
||||
sorted_index_info(y).each { |info| puts sorted_info_keys(info) }
|
@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
|
||||
if $DEBUG
|
||||
c = db.collection('remove1')
|
||||
c.clear
|
||||
50.times { |i| c.insert(:a => i) }
|
||||
c = db.collection('remove2')
|
||||
c.clear
|
||||
c.insert(:a => 3, :b => 1)
|
||||
c.insert(:a => 3, :b => 3)
|
||||
c.insert(:a => 2, :b => 3)
|
||||
c.insert(:b => 3)
|
||||
end
|
||||
|
||||
db.collection('remove1').clear
|
||||
db.collection('remove2').remove('a' => 3)
|
||||
|
||||
if $DEBUG
|
||||
puts "remove1 count = #{db.collection('remove1').count}"
|
||||
puts "remove2 count = #{db.collection('remove2').count}"
|
||||
db.collection('remove2').find.each { |row| puts row.inspect }
|
||||
end
|
@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
LONG_STRING = "lksjhasoh1298alshasoidiohaskjasiouashoasasiugoas" * 6
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
c = db.collection('stress1')
|
||||
|
||||
n1 = 50_000
|
||||
n2 = 10_000
|
||||
|
||||
if $DEBUG
|
||||
n1 = 5
|
||||
n2 = 1
|
||||
c.drop
|
||||
end
|
||||
|
||||
n1.times { |i|
|
||||
c.insert(:name => "asdf#{i}", :date => Time.now, :id => i,
|
||||
:blah => LONG_STRING, :subarray => [])
|
||||
}
|
||||
puts
|
||||
|
||||
n2.times { |i|
|
||||
x = c.find_one({:id => i})
|
||||
x['subarray'] = "foo#{i}"
|
||||
p x
|
||||
c.modify({:id => i}, x)
|
||||
}
|
||||
puts
|
||||
|
||||
if $DEBUG
|
||||
puts "stress1 has #{c.count} records"
|
||||
c.find.each { |row| puts "#{row['id']}: #{row['subarray'].inspect}" }
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
coll = db.collection('part1')
|
||||
|
||||
if $DEBUG
|
||||
coll.drop
|
||||
end
|
||||
|
||||
100.times { |i| coll.insert('x' => i) }
|
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), '_common.rb')
|
||||
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
||||
foo = db.collection('foo')
|
||||
|
||||
if $DEBUG
|
||||
foo.drop
|
||||
foo.insert(:x => 1)
|
||||
end
|
||||
|
||||
foo.modify({:x => 1}, {:x => 1, :y => 2})
|
||||
foo.modify({:x => 2}, {:x => 1, :y => 7})
|
||||
foo.repsert({:x => 3}, {:x => 4, :y => 1})
|
||||
|
||||
if $DEBUG
|
||||
foo.find.each { |row| puts row.inspect }
|
||||
end
|
Loading…
Reference in New Issue
Block a user