Use mongo-qa only if it is in a "sister directory", not a subdirectory.

This commit is contained in:
Jim Menard 2009-01-28 14:15:21 -05:00
parent 8a10a5d37d
commit e17681829f
4 changed files with 11 additions and 24 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@ t
pkg
doc
mongo-ruby-driver-*.gem
mongo-qa

View File

@ -133,17 +133,16 @@ The tests assume that the Mongo database is running on the default port.
The project mongo-qa (http://github.com/mongodb/mongo-qa) contains many more
Mongo driver tests that are language independent. To run thoses tests as part
of the "rake test" task, run
of the "rake test" task, download the code "next to" this directory. So, after
installing the mongo-qa code you would have these two directories next to each
other:
$ rake mongo_qa
$ ls
mongo-qa
mongo-ruby-driver
$ rake test
The mongo_qa task uses the "git clone" command to make a copy of that project
in a directory named mongo-qa. If the directory already exists, then the
mongo_qa task uses "git pull" to updated the code that's there. The Ruby
driver tests will then use some of the data files from that project when it
runs BSON tests. You can delete this directory at any time if you don't want
to run those tests any more.
The tests run just fine if the mongo-qa directory is not there.
Additionally, the script bin/validate is used by the mongo-qa project's
validator script.

View File

@ -11,17 +11,6 @@ Rake::TestTask.new do |t|
t.test_files = FileList['tests/test*.rb']
end
desc "Clone or pull (update) the mongo-qa project used for testing"
task :mongo_qa do
if File.exist?('mongo-qa')
Dir.chdir('mongo-qa') do
system('git pull')
end
else
system('git clone git://github.com/mongodb/mongo-qa.git')
end
end
desc "Generate documentation"
task :rdoc do
FileUtils.rm_rf('html')

View File

@ -8,9 +8,9 @@ require 'test/unit'
# OrderedHash and then test both Ruby-to-BSON and BSON-to-Ruby translations.
#
# There is a whole other project that includes similar tests
# (http://github.com/mongodb/mongo-qa). If the directory ../mongo-qa exists,
# then we find the BSON test files there and use those, too. Use the Rake task
# "mongo_qa" to obtain those tests.
# (http://github.com/mongodb/mongo-qa). If the directory ../../mongo-qa
# exists, (that is, the top-level dir of mongo-qa is next to the top-level dir
# of this project), then we find the BSON test files there and use those, too.
class RoundTripTest < Test::Unit::TestCase
include XGen::Mongo::Driver
@ -47,7 +47,7 @@ EOS
# Dynamically generate one test for each test file. This way, if one test
# fails the others will still run.
create_test_for_round_trip_files_in_dir(File.join(HERE, 'data'))
mongo_qa_dir = File.join(HERE, '..', 'mongo-qa/modules/bson_tests/tests')
mongo_qa_dir = File.join(HERE, '../..', 'mongo-qa/modules/bson_tests/tests')
if File.exist?(mongo_qa_dir)
%w(basic_types complex single_types).each { |subdir_name|
create_test_for_round_trip_files_in_dir(File.join(mongo_qa_dir, subdir_name))