Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8ee601a5
Commit
8ee601a5
authored
Feb 04, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up Mongo databases created by the test suite.
parent
54f508a0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
5 deletions
+51
-5
rakelib/acceptance_test.rake
+7
-3
rakelib/tests.rake
+20
-2
scripts/delete-mongo-test-dbs.js
+24
-0
No files found.
rakelib/acceptance_test.rake
View file @
8ee601a5
...
@@ -80,11 +80,15 @@ namespace :test do
...
@@ -80,11 +80,15 @@ namespace :test do
end
end
desc
"Run acceptance tests for the
#{
system
}
without collectstatic or db migrations"
desc
"Run acceptance tests for the
#{
system
}
without collectstatic or db migrations"
task
"
#{
system
}
:fast"
,
[
:harvest_args
]
=>
[
task
"
#{
system
}
:fast"
,
[
:harvest_args
]
=>
[
:clean_reports_dir
,
ACCEPTANCE_REPORT_DIR
]
do
|
t
,
args
|
:clean_reports_dir
,
ACCEPTANCE_REPORT_DIR
,
]
do
|
t
,
args
|
args
.
with_defaults
(
:harvest_args
=>
''
)
args
.
with_defaults
(
:harvest_args
=>
''
)
begin
run_acceptance_tests
(
system
,
args
.
harvest_args
)
run_acceptance_tests
(
system
,
args
.
harvest_args
)
ensure
Rake
::
Task
[
:'test:clean_mongo'
].
reenable
Rake
::
Task
[
:'test:clean_mongo'
].
invoke
end
end
end
end
end
end
end
...
...
rakelib/tests.rake
View file @
8ee601a5
...
@@ -79,7 +79,15 @@ TEST_TASK_DIRS = []
...
@@ -79,7 +79,15 @@ TEST_TASK_DIRS = []
# messing with static files.
# messing with static files.
task
"fasttest_
#{
system
}
"
,
[
:test_id
]
=>
[
test_id_dir
,
report_dir
,
:clean_reports_dir
]
do
|
t
,
args
|
task
"fasttest_
#{
system
}
"
,
[
:test_id
]
=>
[
test_id_dir
,
report_dir
,
:clean_reports_dir
]
do
|
t
,
args
|
args
.
with_defaults
(
:test_id
=>
nil
)
args
.
with_defaults
(
:test_id
=>
nil
)
begin
run_tests
(
system
,
report_dir
,
args
.
test_id
)
run_tests
(
system
,
report_dir
,
args
.
test_id
)
ensure
Rake
::
Task
[
:'test:clean_mongo'
].
reenable
Rake
::
Task
[
:'test:clean_mongo'
].
invoke
end
end
end
task
:fasttest
=>
"fasttest_
#{
system
}
"
task
:fasttest
=>
"fasttest_
#{
system
}
"
...
@@ -97,13 +105,18 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
...
@@ -97,13 +105,18 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
desc
"Run tests for common lib
#{
lib
}
"
desc
"Run tests for common lib
#{
lib
}
"
task
"test_
#{
lib
}
"
,
[
:test_id
]
=>
[
task
"test_
#{
lib
}
"
,
[
:test_id
]
=>
[
test_id_dir
,
report_dir
,
:clean_test_files
,
test_id_dir
,
report_dir
,
:clean_test_files
,
:clean_reports_dir
,
:install_prereqs
:clean_reports_dir
,
:install_prereqs
]
do
|
t
,
args
|
]
do
|
t
,
args
|
args
.
with_defaults
(
:test_id
=>
lib
)
args
.
with_defaults
(
:test_id
=>
lib
)
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
cmd
=
"nosetests --id-file=
#{
test_ids
}
#{
args
.
test_id
}
"
cmd
=
"nosetests --id-file=
#{
test_ids
}
#{
args
.
test_id
}
"
begin
test_sh
(
lib
,
run_under_coverage
(
cmd
,
lib
))
test_sh
(
lib
,
run_under_coverage
(
cmd
,
lib
))
ensure
Rake
::
Task
[
:'test:clean_mongo'
].
reenable
Rake
::
Task
[
:'test:clean_mongo'
].
invoke
end
end
end
TEST_TASK_DIRS
<<
lib
TEST_TASK_DIRS
<<
lib
...
@@ -128,6 +141,11 @@ end
...
@@ -128,6 +141,11 @@ end
namespace
:test
do
namespace
:test
do
desc
"Run all python tests"
desc
"Run all python tests"
task
:python
,
[
:test_id
]
task
:python
,
[
:test_id
]
desc
"Drop Mongo databases created by the test suite"
task
:clean_mongo
do
sh
(
"mongo
#{
REPO_ROOT
}
/scripts/delete-mongo-test-dbs.js"
)
end
end
end
desc
"Build the html, xml, and diff coverage reports"
desc
"Build the html, xml, and diff coverage reports"
...
...
scripts/delete-mongo-test-dbs.js
0 → 100644
View file @
8ee601a5
/*
Drop all Mongo test databases.
Usage example:
mongo delete-mongo-test-dbs.js
will drop every database that starts with "test_" or "acceptance_",
but ignore other databases.
*/
String
.
prototype
.
startsWith
=
function
(
substring
)
{
return
(
this
.
indexOf
(
substring
)
==
0
);
}
var
dbNameList
=
db
.
getMongo
().
getDBNames
();
for
(
var
i
in
dbNameList
)
{
if
(
dbNameList
[
i
].
startsWith
(
'test_'
)
||
dbNameList
[
i
].
startsWith
(
'acceptance_'
))
{
dbToDrop
=
db
.
getMongo
().
getDB
(
dbNameList
[
i
]);
print
(
"Dropping test db "
+
dbNameList
[
i
]);
dbToDrop
.
dropDatabase
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment