forked from mongodb/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoke-tests.txt
166 lines (121 loc) · 4.75 KB
/
smoke-tests.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
===========
Smoke Tests
===========
Test Organization
-----------------
* :file:`dbtests/.*cpp` has C++ unit tests
* :file:`jstests/*.js` has core tests
* :file:`jstests/repl*/*.js` has replication tests
* :file:`jstests/sharding/*.js` has sharding tests
* :file:`slowNightly/*js` has tests that take longer and run only at night
* :file:`slowWeekly/*.js` has tests that take even longer and run only once a week
Running all the tests
---------------------
.. code-block:: sh
scons smoke smokeCppUnittests smokeDisk smokeTool smokeAuth startMongod smokeClient smokeJs
scons startMongodSmallOplog smokeJs
scons startMongod smokeJsSlowNightly
scons smokeTool
scons smokeReplSets
scons smokeDur
scons mongosTest smokeSharding
scons smokeRepl smokeClone
scons startMongod smokeParallel
smoke.py
--------
:file:`smoke.py` lets you run a subsets of the tests in :file:`jstests/`.
When it is running tests, it starts up an instance of mongod, runs the tests,
and then shuts it down again.
You can run it while running other instances of MongoDB on the same machine:
it uses ports in the 30000 range and its own data directories.
For the moment, :file:`smoke.py` must be run from the top-level directory
of a MongoDB source repository.
This directory must contain at least the :program:`mongo` and
:program:`mongod` binaries.
To run certain tests, you'll also need to build the tools and :program:`mongos`.
It's a good idea to run ``scons .`` before running the tests.
To run :file:`smoke.py` you'll need a recent version of
`PyMongo <http://api.mongodb.org/python/current/installation.html>`_.
To see the possible options, run:
.. code-block:: sh
$ python buildscripts/smoke.py --help
Usage: smoke.py [OPTIONS] ARGS*
Options:
-h, --help show this help message and exit
--mode=MODE If "files", ARGS are filenames; if "suite", ARGS are
sets of tests (suite)
--test-path=TEST_PATH
Path to the test executables to run, currently only
used for 'client' (none)
--mongod=MONGOD_EXECUTABLE
Path to mongod to run (/Users/mike/10gen/mongo/mongod)
--port=MONGOD_PORT Port the mongod will bind to (32000)
--mongo=SHELL_EXECUTABLE
Path to mongo, for .js test files
(/Users/mike/10gen/mongo/mongo)
--continue-on-failure
If supplied, continue testing even after a test fails
--from-file=FILE Run tests/suites named in FILE, one test per line, '-'
means stdin
--smoke-db-prefix=SMOKE_DB_PREFIX
Prefix to use for the mongods' dbpaths ('')
--small-oplog Run tests with master/slave replication & use a small
oplog
.. note::
By default, :file:`smoke.py` will run tests that create data in :file:`/data/db`,
which may interfere with other MongoDB instances you are running.
To change the directory in which the smoke tests create databases, use
``--smoke-db-prefix=/some/other/path``
To run specific tests, use the :option:`--mode=files` option:
.. code-block:: sh
python buildscripts/smoke.py --mode=files jstests/find1.js
You can specify as many files as you want.
You can also run a suite of tests. Suites are predefined and include:
* `test`
* `all`
* `perf`
* `js`
* `quota`
* `jsPerf`
* `disk`
* `jsSlowNightly`
* `jsSlowWeekly`
* `parallel`
* `clone`
* `repl` (master/slave replication tests)
* `replSets` (replica set tests)
* `auth`
* `sharding`
* `tool`
* `client`
* `mongosTest`
To run a suite, specify the suite's name:
.. code-block:: sh
python buildscripts/smoke.py js
Running a jstest manually
-------------------------
You can run a jstest directly from the shell, for example:
.. code-block:: sh
mongo --nodb jstests/replsets/replsetarb3.js
Running the C++ unit tests
--------------------------
The tests under jstests/ folder are written in mongo shell javascript.
However there are a set of C++ unit tests also. To run them:
.. code-block:: sh
scons test
./test
Build the unit tests (in src/mongo/unittest/ by running:
.. code-block:: sh
$ scons build/unittests.txt
/* build output */
Generating build/unittests.txt
build/linux2/dd/durableDefaultOff/mongo/platform/atomic_word_test
...
build/linux2/dd/durableDefaultOff/mongo/bson_template_evaluator_test
build/linux2/dd/durableDefaultOff/mongo/balancer_policy_test
scons: done building targets.
Then use the line above to run the binary generated:
.. code-block:: sh
$ ./build/linux2/dd/durableDefaultOff/mongo/platform/atomic_word_test
.. seealso::
* `scons <http://www.scons.org/>`_