This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch 1732-mango-tests-windows
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 375853cca38d127260f62127c15eb985c903d500
Author: Joan Touzet <[email protected]>
AuthorDate: Tue Nov 13 16:42:23 2018 -0500

    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.
---
 Makefile.win                              |  2 ++
 make.cmd                                  |  3 +++
 src/mango/test/15-execution-stats-test.py | 11 +++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Makefile.win b/Makefile.win
index d0305e2..f0bc0f7 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -119,6 +119,8 @@ check: all
        @$(MAKE) -f Makefile.win test-cluster-without-quorum
        @$(MAKE) -f Makefile.win eunit
        @$(MAKE) -f Makefile.win javascript
+       @$(MAKE) -f Makefile.win mango-test
+#      @$(MAKE) -f Makefile.win elixir
 
 
 .PHONY: eunit
diff --git a/make.cmd b/make.cmd
new file mode 100644
index 0000000..bf86778
--- /dev/null
+++ b/make.cmd
@@ -0,0 +1,3 @@
+@ECHO OFF
+
+make.exe -f Makefile.win %*
diff --git a/src/mango/test/15-execution-stats-test.py 
b/src/mango/test/15-execution-stats-test.py
index 6b7408b..92a5995 100644
--- a/src/mango/test/15-execution-stats-test.py
+++ b/src/mango/test/15-execution-stats-test.py
@@ -12,6 +12,7 @@
 
 
 import mango
+import os
 import unittest
 
 class ExecutionStatsTests(mango.UserDocsTests):
@@ -23,7 +24,10 @@ class ExecutionStatsTests(mango.UserDocsTests):
         self.assertEqual(resp["execution_stats"]["total_docs_examined"], 3)
         
self.assertEqual(resp["execution_stats"]["total_quorum_docs_examined"], 0)
         self.assertEqual(resp["execution_stats"]["results_returned"], 3)
-        self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
+        # See https://github.com/apache/couchdb/issues/1732
+        # Erlang os:timestamp() only has ms accuracy on Windows!
+        if os.name != 'nt':
+            self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
 
     def test_no_execution_stats(self):
         resp = self.db.find({"age": {"$lt": 35}}, return_raw=True, 
executionStats=False)
@@ -36,7 +40,10 @@ class ExecutionStatsTests(mango.UserDocsTests):
         self.assertEqual(resp["execution_stats"]["total_docs_examined"], 0)
         
self.assertEqual(resp["execution_stats"]["total_quorum_docs_examined"], 3)
         self.assertEqual(resp["execution_stats"]["results_returned"], 3)
-        self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
+        # See https://github.com/apache/couchdb/issues/1732
+        # Erlang os:timestamp() only has ms accuracy on Windows!
+        if os.name != 'nt':
+            self.assertGreater(resp["execution_stats"]["execution_time_ms"], 0)
 
     def test_results_returned_limit(self):
         resp = self.db.find({"age": {"$lt": 35}}, limit=2, return_raw=True, 
executionStats=True)

Reply via email to