From 990c00b261d5e1358acdf6087881184f907c89a9 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Tue, 5 Jan 2010 18:00:34 -0500 Subject: [PATCH] removed old mongo-qa tests --- test/mongo-qa/_common.rb | 8 ------- test/mongo-qa/admin | 26 --------------------- test/mongo-qa/capped | 22 ------------------ test/mongo-qa/count1 | 18 --------------- test/mongo-qa/dbs | 22 ------------------ test/mongo-qa/find | 10 -------- test/mongo-qa/find1 | 15 ------------ test/mongo-qa/gridfs_in | 16 ------------- test/mongo-qa/gridfs_out | 17 -------------- test/mongo-qa/indices | 49 ---------------------------------------- test/mongo-qa/remove | 25 -------------------- test/mongo-qa/stress1 | 35 ---------------------------- test/mongo-qa/test1 | 11 --------- test/mongo-qa/update | 18 --------------- 14 files changed, 292 deletions(-) delete mode 100644 test/mongo-qa/_common.rb delete mode 100644 test/mongo-qa/admin delete mode 100644 test/mongo-qa/capped delete mode 100644 test/mongo-qa/count1 delete mode 100644 test/mongo-qa/dbs delete mode 100644 test/mongo-qa/find delete mode 100644 test/mongo-qa/find1 delete mode 100644 test/mongo-qa/gridfs_in delete mode 100644 test/mongo-qa/gridfs_out delete mode 100755 test/mongo-qa/indices delete mode 100644 test/mongo-qa/remove delete mode 100755 test/mongo-qa/stress1 delete mode 100644 test/mongo-qa/test1 delete mode 100644 test/mongo-qa/update diff --git a/test/mongo-qa/_common.rb b/test/mongo-qa/_common.rb deleted file mode 100644 index fc0f9bb..0000000 --- a/test/mongo-qa/_common.rb +++ /dev/null @@ -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 diff --git a/test/mongo-qa/admin b/test/mongo-qa/admin deleted file mode 100644 index a415bea..0000000 --- a/test/mongo-qa/admin +++ /dev/null @@ -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] diff --git a/test/mongo-qa/capped b/test/mongo-qa/capped deleted file mode 100644 index 907bfcc..0000000 --- a/test/mongo-qa/capped +++ /dev/null @@ -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 << '-' -} diff --git a/test/mongo-qa/count1 b/test/mongo-qa/count1 deleted file mode 100644 index 11f7918..0000000 --- a/test/mongo-qa/count1 +++ /dev/null @@ -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 diff --git a/test/mongo-qa/dbs b/test/mongo-qa/dbs deleted file mode 100644 index 92da779..0000000 --- a/test/mongo-qa/dbs +++ /dev/null @@ -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) diff --git a/test/mongo-qa/find b/test/mongo-qa/find deleted file mode 100644 index d9685eb..0000000 --- a/test/mongo-qa/find +++ /dev/null @@ -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) diff --git a/test/mongo-qa/find1 b/test/mongo-qa/find1 deleted file mode 100644 index 2dc4b15..0000000 --- a/test/mongo-qa/find1 +++ /dev/null @@ -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'] } diff --git a/test/mongo-qa/gridfs_in b/test/mongo-qa/gridfs_in deleted file mode 100644 index 040e7c5..0000000 --- a/test/mongo-qa/gridfs_in +++ /dev/null @@ -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) - } -} diff --git a/test/mongo-qa/gridfs_out b/test/mongo-qa/gridfs_out deleted file mode 100644 index fa2c89c..0000000 --- a/test/mongo-qa/gridfs_out +++ /dev/null @@ -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) - } -} diff --git a/test/mongo-qa/indices b/test/mongo-qa/indices deleted file mode 100755 index 729395d..0000000 --- a/test/mongo-qa/indices +++ /dev/null @@ -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) } diff --git a/test/mongo-qa/remove b/test/mongo-qa/remove deleted file mode 100644 index 6bacb35..0000000 --- a/test/mongo-qa/remove +++ /dev/null @@ -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 diff --git a/test/mongo-qa/stress1 b/test/mongo-qa/stress1 deleted file mode 100755 index 3cfdd9f..0000000 --- a/test/mongo-qa/stress1 +++ /dev/null @@ -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 diff --git a/test/mongo-qa/test1 b/test/mongo-qa/test1 deleted file mode 100644 index b9943cd..0000000 --- a/test/mongo-qa/test1 +++ /dev/null @@ -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) } diff --git a/test/mongo-qa/update b/test/mongo-qa/update deleted file mode 100644 index cc5271f..0000000 --- a/test/mongo-qa/update +++ /dev/null @@ -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