Skip to content

Commit 375853c

Browse files
committed
Mango test suite Windows fixes, closes #1732
Unfortuantely, os:timestamp() on Windows only has millisecond accuracy. That means that the two Mango tests checking for a positive value of execution_time fail, since these tests appear to be running in <1ms on my test setup (a rather anemic Windows VM!) This change disables only the check for execution_time in two tests, and leaves the remainder of the execution_stats checks in place on Windows. It also introduces a convenience "make.cmd" file so you can "make check" without typing "make -f Makefile.win check" all the time.
1 parent b568496 commit 375853c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Makefile.win

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ check: all
119119
@$(MAKE) -f Makefile.win test-cluster-without-quorum
120120
@$(MAKE) -f Makefile.win eunit
121121
@$(MAKE) -f Makefile.win javascript
122+
@$(MAKE) -f Makefile.win mango-test
123+
# @$(MAKE) -f Makefile.win elixir
122124

123125

124126
.PHONY: eunit

make.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
3+
make.exe -f Makefile.win %*

src/mango/test/15-execution-stats-test.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313

1414
import mango
15+
import os
1516
import unittest
1617

1718
class ExecutionStatsTests(mango.UserDocsTests):
@@ -23,7 +24,10 @@ def test_simple_json_index(self):
2324
self.assertEqual(resp["execution_stats"]["total_docs_examined"], 3)
2425
self.assertEqual(resp["execution_stats"]["total_quorum_docs_examined"], 0)
2526
self.assertEqual(resp["execution_stats"]["results_returned"], 3)
26-
self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
27+
# See https://github.com/apache/couchdb/issues/1732
28+
# Erlang os:timestamp() only has ms accuracy on Windows!
29+
if os.name != 'nt':
30+
self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
2731

2832
def test_no_execution_stats(self):
2933
resp = self.db.find({"age": {"$lt": 35}}, return_raw=True, executionStats=False)
@@ -36,7 +40,10 @@ def test_quorum_json_index(self):
3640
self.assertEqual(resp["execution_stats"]["total_docs_examined"], 0)
3741
self.assertEqual(resp["execution_stats"]["total_quorum_docs_examined"], 3)
3842
self.assertEqual(resp["execution_stats"]["results_returned"], 3)
39-
self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
43+
# See https://github.com/apache/couchdb/issues/1732
44+
# Erlang os:timestamp() only has ms accuracy on Windows!
45+
if os.name != 'nt':
46+
self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
4047

4148
def test_results_returned_limit(self):
4249
resp = self.db.find({"age": {"$lt": 35}}, limit=2, return_raw=True, executionStats=True)

0 commit comments

Comments
 (0)