chiark / gitweb /
exercise the C client a bit from tests
[disorder] / tests / dbversion.py
old mode 100644 (file)
new mode 100755 (executable)
index e5b5c48..4fcdbd2
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA
 #
-import dtest,time,disorder,sys,re
+import dtest,time,disorder,sys,re,subprocess
 
 def test():
     """Database version tests"""
@@ -28,26 +28,12 @@ def test():
     dtest.copyfile(config, configsave)
     open(config, "a").write("dbversion 1\n")
     dtest.start_daemon()
-    time.sleep(2)
     dtest.stop_daemon()
     # Revert to default configuration
     dtest.copyfile(configsave, config)
+    print "Testing daemon manages to upgrade..."
     dtest.start_daemon()
-    time.sleep(2)
-    c = disorder.client()
-    try:
-        v = c.version()
-        print "unexpected success"
-        ok = False
-    except disorder.communicationError, e:
-        if re.search("connection refused", str(e)):
-            print "unexpected error: %s" % e
-            ok = False
-        else:
-            ok = True
-    dtest.stop_daemon()
-    if not ok:
-        sys.exit(1)
+    assert dtest.check_files() == 0, "dtest.check_files"
 
 if __name__ == '__main__':
-    dtest.run(test)
+    dtest.run()