gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31482 - in gnunet/src/integration-tests: . confs


From: gnunet
Subject: [GNUnet-SVN] r31482 - in gnunet/src/integration-tests: . confs
Date: Tue, 17 Dec 2013 16:32:54 +0100

Author: wachs
Date: 2013-12-17 16:32:54 +0100 (Tue, 17 Dec 2013)
New Revision: 31482

Added:
   gnunet/src/integration-tests/test_integration_reconnect.py.in
   gnunet/src/integration-tests/test_integration_reconnect_nat.py.in
Removed:
   gnunet/src/integration-tests/test_integration_restart.py.in
Modified:
   gnunet/src/integration-tests/Makefile.am
   gnunet/src/integration-tests/confs/c_bootstrap_server.conf
   gnunet/src/integration-tests/confs/c_nat_client.conf
   gnunet/src/integration-tests/confs/c_no_nat_client.conf
   gnunet/src/integration-tests/confs/test_defaults.conf
Log:
restructuring configs + enabling additional plugins


Modified: gnunet/src/integration-tests/Makefile.am
===================================================================
--- gnunet/src/integration-tests/Makefile.am    2013-12-17 15:00:28 UTC (rev 
31481)
+++ gnunet/src/integration-tests/Makefile.am    2013-12-17 15:32:54 UTC (rev 
31482)
@@ -17,7 +17,8 @@
 check_SCRIPTS = \
   test_integration_bootstrap_and_connect.py \
   test_integration_disconnect.py \
-  test_integration_restart.py  
+  test_integration_reconnect.py \
+  test_integration_reconnect_nat.py    
 #  test_integration_bootstrap_and_connect_and_disconnect.py \
 # test_integration_bootstrap_and_connect_and_disconnect_nat.py \
 # test_integration_clique.py \
@@ -51,43 +52,50 @@
        $(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > 
test_integration_bootstrap_and_connect.py
        chmod +x test_integration_bootstrap_and_connect.py
 
+test_integration_disconnect.py: test_integration_disconnect.py.in Makefile
+       $(do_subst) < $(srcdir)/test_integration_disconnect.py.in > 
test_integration_disconnect.py
+       chmod +x test_integration_disconnect.py
 
+test_integration_reconnect.py: test_integration_reconnect.py.in Makefile
+       $(do_subst) < $(srcdir)/test_integration_reconnect.py.in > 
test_integration_reconnect.py
+       chmod +x test_integration_reconnect.py
 
+test_integration_reconnect_nat.py: test_integration_reconnect_nat.py.in 
Makefile
+       $(do_subst) < $(srcdir)/test_integration_reconnect_nat.py.in > 
test_integration_reconnect_nat.py
+       chmod +x test_integration_reconnect_nat.py
 
-test_integration_bootstrap_and_connect_and_disconnect.py: 
test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile
-       $(do_subst) < 
$(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > 
test_integration_bootstrap_and_connect_and_disconnect.py
-       chmod +x test_integration_bootstrap_and_connect_and_disconnect.py
 
-test_integration_bootstrap_and_connect_and_disconnect_nat.py: 
test_integration_bootstrap_and_connect_and_disconnect_nat.py.in Makefile
-       $(do_subst) < 
$(srcdir)/test_integration_bootstrap_and_connect_and_disconnect_nat.py.in > 
test_integration_bootstrap_and_connect_and_disconnect_nat.py
-       chmod +x test_integration_bootstrap_and_connect_and_disconnect_nat.py
 
 
-test_integration_disconnect.py: test_integration_disconnect.py.in Makefile
-       $(do_subst) < $(srcdir)/test_integration_disconnect.py.in > 
test_integration_disconnect.py
-       chmod +x test_integration_disconnect.py
+#test_integration_bootstrap_and_connect_and_disconnect.py: 
test_integration_bootstrap_and_connect_and_disconnect.py.in Makefile
+#      $(do_subst) < 
$(srcdir)/test_integration_bootstrap_and_connect_and_disconnect.py.in > 
test_integration_bootstrap_and_connect_and_disconnect.py
+#      chmod +x test_integration_bootstrap_and_connect_and_disconnect.py
 
+#test_integration_bootstrap_and_connect_and_disconnect_nat.py: 
test_integration_bootstrap_and_connect_and_disconnect_nat.py.in Makefile
+#      $(do_subst) < 
$(srcdir)/test_integration_bootstrap_and_connect_and_disconnect_nat.py.in > 
test_integration_bootstrap_and_connect_and_disconnect_nat.py
+#      chmod +x test_integration_bootstrap_and_connect_and_disconnect_nat.py
+
+
+
 #test_integration_disconnect_nat.py: test_integration_disconnect_nat.py.in 
Makefile
 #      $(do_subst) < $(srcdir)/test_integration_disconnect_nat.py.in > 
test_integration_disconnect_nat.py
 #      chmod +x test_integration_disconnect_nat.py
 
-test_integration_restart.py: test_integration_restart.py.in Makefile
-       $(do_subst) < $(srcdir)/test_integration_restart.py.in > 
test_integration_restart.py
-       chmod +x test_integration_restart.py
 
-test_integration_clique.py: test_integration_clique.py.in Makefile
-       $(do_subst) < $(srcdir)/test_integration_clique.py.in > 
test_integration_clique.py
-       chmod +x test_integration_clique.py
 
-test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile
-       $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > 
test_integration_clique_nat.py
-       chmod +x test_integration_clique_nat.py
+#test_integration_clique.py: test_integration_clique.py.in Makefile
+#      $(do_subst) < $(srcdir)/test_integration_clique.py.in > 
test_integration_clique.py
+#      chmod +x test_integration_clique.py
 
-test_integration_connect_on_restart.py: 
test_integration_connect_on_restart.py.in Makefile
-       $(do_subst) < $(srcdir)/test_integration_connect_on_restart.py.in > 
test_integration_connect_on_restart.py
-       chmod +x test_integration_connect_on_restart.py
+#test_integration_clique_nat.py: test_integration_clique_nat.py.in Makefile
+#      $(do_subst) < $(srcdir)/test_integration_clique_nat.py.in > 
test_integration_clique_nat.py
+#      chmod +x test_integration_clique_nat.py
 
+#test_integration_connect_on_restart.py: 
test_integration_connect_on_restart.py.in Makefile
+#      $(do_subst) < $(srcdir)/test_integration_connect_on_restart.py.in > 
test_integration_connect_on_restart.py
+#      chmod +x test_integration_connect_on_restart.py
 
+
 EXTRA_DIST = \
    gnunet_testing.py.in \
    gnunet_pyexpect.py.in \
@@ -96,7 +104,7 @@
    test_integration_bootstrap_and_connect_and_disconnect_nat.py.in \
    test_integration_connect_on_restart.py.in \
    test_integration_disconnect.py.in \
-   test_integration_restart.py.in \
+   test_integration_reconnect.py.in \
    test_integration_clique.py.in \
    test_integration_clique_nat.py.in \
    confs/test_defaults.conf \

Modified: gnunet/src/integration-tests/confs/c_bootstrap_server.conf
===================================================================
--- gnunet/src/integration-tests/confs/c_bootstrap_server.conf  2013-12-17 
15:00:28 UTC (rev 31481)
+++ gnunet/src/integration-tests/confs/c_bootstrap_server.conf  2013-12-17 
15:32:54 UTC (rev 31482)
@@ -1,12 +1,39 @@
 @INLINE@ confs/test_defaults.conf
 
-
 [PATHS]
 GNUNET_TEST_HOME = /tmp/c_bootstrap_server/
 
 [PEER]
 PRIVATE_KEY = hostkeys/c_bootstrap_server
 
+
+[transport]
+UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8
+PORT = 20011
+PLUGINS = tcp udp http_client https_client http_server https_server
+
+[transport-tcp]
+PORT = 20010
+ADVERTISED_PORT = 20010
+
+[transport-udp]
+PORT = 20009
+
+[transport-http_server]
+PORT = 20008
+
+[transport-https_server]
+PORT = 20007
+
+[hostlist]
+OPTIONS = -p
+SERVERs = 
+
+[nat]
+BEHIND_NAT = NO
+DISABLEV6 = NO
+
+
 [arm]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-4
 PORT = 20004
@@ -45,17 +72,6 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-6
 PORT = 20005
 
-[transport]
-UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-8
-PORT = 20011
-
-[transport-tcp]
-PORT = 20010
-ADVERTISED_PORT = 20010
-
-[transport-udp]
-PORT = 20009
-
 [gns]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-gns-15
 PORT = 20018
@@ -64,12 +80,6 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-16
 PORT = 20019
 
-
-
-[hostlist]
-OPTIONS = -p
-SERVERs = 
-
 [vpn]
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-15
 
@@ -85,10 +95,5 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-12
 PORT = 20015
 
-[transport-http]
-PORT = 20008
 
-[transport-https]
-PORT = 20007
 
-

Modified: gnunet/src/integration-tests/confs/c_nat_client.conf
===================================================================
--- gnunet/src/integration-tests/confs/c_nat_client.conf        2013-12-17 
15:00:28 UTC (rev 31481)
+++ gnunet/src/integration-tests/confs/c_nat_client.conf        2013-12-17 
15:32:54 UTC (rev 31482)
@@ -1,5 +1,32 @@
 @INLINE@ confs/test_defaults.conf
 
+[PATHS]
+GNUNET_TEST_HOME = /tmp/c_nat_client/
+
+[PEER]
+PRIVATE_KEY = hostkeys/c_nat_client
+
+
+[transport]
+UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50
+PORT = 20065
+PLUGINS = tcp udp
+
+[transport-tcp]
+PORT = 0
+ADVERTISED_PORT = 20064
+
+[transport-udp]
+PORT = 0
+
+[hostlist]
+SERVERS = http://localhost:8080/
+
+[nat]
+BEHIND_NAT = YES
+DISABLEV6 = NO
+
+
 [arm]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-46
 PORT = 20058
@@ -28,20 +55,6 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-48
 PORT = 20059
 
-[transport]
-UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-50
-PORT = 20065
-
-[transport-tcp]
-PORT = 0
-ADVERTISED_PORT = 20064
-
-[transport-udp]
-PORT = 0
-
-[hostlist]
-SERVERS = http://localhost:8080/
-
 [dv]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-b_nat_c-1
 
@@ -49,18 +62,6 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-peerinfo-52
 PORT = 20067
 
-[PATHS]
-GNUNET_TEST_HOME = /tmp/c_nat_client
-
-[PEER]
-PRIVATE_KEY = hostkeys/c_nat_client
-
 [nse]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-nse-54
-PORT = 20069
-
-[transport-http]
-PORT = 0
-
-[transport-https]
-PORT = 0
+PORT = 20069
\ No newline at end of file

Modified: gnunet/src/integration-tests/confs/c_no_nat_client.conf
===================================================================
--- gnunet/src/integration-tests/confs/c_no_nat_client.conf     2013-12-17 
15:00:28 UTC (rev 31481)
+++ gnunet/src/integration-tests/confs/c_no_nat_client.conf     2013-12-17 
15:32:54 UTC (rev 31482)
@@ -6,8 +6,29 @@
 [PEER]
 PRIVATE_KEY = hostkeys/c_no_nat_client
 
+
+[transport]
+PLUGINS = tcp udp http_client https_client 
+UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22
+PORT = 20029
+
+[transport-tcp]
+PORT = 20028
+ADVERTISED_PORT = 20028
+
+[transport-udp]
+PORT = 20027
+BROADCAST_INTERVAL = 30 s
+
+[hostlist]
+SERVERS = http://localhost:8080/
+
+[nat]
+BEHIND_NAT = NO
+DISABLEV6 = NO
+
+
 [arm]
-DEFAULTSERVICES = topology hostlist dht nse mesh fs
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-arm-18
 PORT = 20022
 
@@ -53,10 +74,6 @@
 DATABASE = heap
 QUOTA = 50 MB
 
-[nat]
-BEHIND_NAT = NO
-DISABLEV6 = NO
-
 [gnunet-nat-server]
 PORT = 20020
 
@@ -64,23 +81,6 @@
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-fs-20
 PORT = 20023
 
-[transport]
-PLUGINS = tcp udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-transport-22
-UNIX_MATCH_UID = NO
-PORT = 20029
-
-[transport-tcp]
-PORT = 20028
-ADVERTISED_PORT = 20028
-
-[transport-udp]
-PORT = 20027
-BROADCAST_INTERVAL = 30 s
-
-[hostlist]
-SERVERS = http://localhost:8080/
-
 [vpn]
 BINARY = gnunet-service-vpn
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn-29
@@ -114,10 +114,3 @@
 [dv]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test-service-dv-36
 PORT = 20039
-
-[transport-http]
-PORT = 20026
-
-[transport-https]
-PORT = 20025
-

Modified: gnunet/src/integration-tests/confs/test_defaults.conf
===================================================================
--- gnunet/src/integration-tests/confs/test_defaults.conf       2013-12-17 
15:00:28 UTC (rev 31481)
+++ gnunet/src/integration-tests/confs/test_defaults.conf       2013-12-17 
15:32:54 UTC (rev 31482)
@@ -40,8 +40,7 @@
 WEAKRANDOM = NO
 
 [nat]
-BEHIND_NAT = YES
-DISABLEV6 = YES
+BEHIND_NAT = NO
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
 BINDTO = 127.0.0.1
@@ -53,9 +52,6 @@
 UPDATE_DIR = $GNUNET_TEST_HOME/updates/
 TRUST = $GNUNET_TEST_HOME/data/credit/
 
-[transport]
-PLUGINS = tcp
-
 [transport-tcp]
 USE_LOCALADDR = YES
 

Copied: gnunet/src/integration-tests/test_integration_reconnect.py.in (from rev 
31475, gnunet/src/integration-tests/test_integration_restart.py.in)
===================================================================
--- gnunet/src/integration-tests/test_integration_reconnect.py.in               
                (rev 0)
+++ gnunet/src/integration-tests/test_integration_reconnect.py.in       
2013-12-17 15:32:54 UTC (rev 31482)
@@ -0,0 +1,225 @@
address@hidden@
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# 
+import sys
+import os
+import subprocess
+import re
+import shutil
+import time
+import signal
+from gnunet_testing import Peer
+from gnunet_testing import Test
+from gnunet_testing import Check
+from gnunet_testing import Condition
+from gnunet_testing import * 
+ 
+
+#
+# This test tests if a fresh peer bootstraps from a hostlist server and then
+# successfully connects to the server. When both peers are connected
+# in transport, core, topology, fs, botth peers are shutdown and restarted 
+#
+# Conditions for successful exit:
+# Both peers have 1 connected peer in transport, core, topology, fs after 
restart
+
+#definitions
+
+
+testname = "test_integration_restart"
+verbose = True
+check_timeout = 180
+
+if os.name == "nt":
+  tmp = os.getenv ("TEMP")
+else:
+  tmp = "/tmp"
+
+def cleanup ():
+    retries = 10
+    path = os.path.join (tmp, "c_bootstrap_server")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path) 
+        
+    
+    retries = 10
+    path = os.path.join (tmp, "c_no_nat_client")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path) 
+
+def success_restart_cont (check):
+       global success 
+       print 'Peers connected successfully after restart'
+       server.stop ()
+       client.stop ()
+       success = True; 
+
+
+def fail_restart_cont (check):    
+       global success 
+       success = False;
+       print 'Peers failed to connect after restart'
+       check.evaluate(True)   
+    
+
+def success_connect_cont (check):
+       print 'Peers connected successfully'
+       server.stop ()
+       client.stop ()
+       
+       time.sleep(5)
+       
+       test.p ('Restarting client & server')
+       server.start ()
+       client.start ()
+       
+       check = Check (test)
+       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
+       
+       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
+       
+       check.run_blocking (check_timeout, success_restart_cont, 
fail_restart_cont)
+
+
+def fail_connect_cont (check):    
+       global success 
+       success= False;
+       print 'Peers failed to connect'
+       check.evaluate(True)
+
+
+def check_connect ():
+       check = Check (test)
+       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
+       
+       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
+       
+       check.run_blocking (check_timeout, success_connect_cont, 
fail_connect_cont)
+
+# 
+# Test execution
+# 
+
+
+def SigHandler(signum = None, frame = None):
+       global success  
+       global server
+       global client  
+       
+       print 'Test was aborted!'
+       if (None != server):
+               server.stop ()
+       if (None != server):            
+               client.stop ()
+       cleanup ()
+       sys.exit(success)
+
+def run ():
+       global success
+       global test
+       global server
+       global client
+       
+       success = False
+       server = None
+       client = None   
+
+       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+               signal.signal(sig, SigHandler)
+       
+       
+       test = Test ('test_integration_disconnect', verbose)
+       cleanup ()
+       server = Peer(test, './confs/c_bootstrap_server.conf');
+       server.start();
+       
+       client = Peer(test, './confs/c_no_nat_client.conf');
+       client.start();
+       
+
+       if (True != server.start()):
+               print 'Failed to start server'
+               if (None != server):
+                       server.stop ()
+               if (None != server):            
+                       client.stop ()
+               cleanup ()
+               sys.exit(success)
+       if (True != client.start()):
+               print 'Failed to start client'
+               if (None != server):
+                       server.stop ()
+               if (None != server):            
+                       client.stop ()
+               cleanup ()
+               sys.exit(success)
+       
+       check_connect ()
+       
+       server.stop ()    
+       client.stop ()
+       cleanup ()
+       
+       if (success == False):
+               print ('Test failed')
+               return True
+       else:
+               return False
+
+       
+try:
+    run ()
+except (KeyboardInterrupt, SystemExit):    
+    print 'Test interrupted'
+    server.stop ()
+    client.stop ()
+    cleanup ()
+if (success == False):
+       sys.exit(1)   
+else:
+       sys.exit(0)    
+
+       
\ No newline at end of file

Added: gnunet/src/integration-tests/test_integration_reconnect_nat.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_reconnect_nat.py.in           
                (rev 0)
+++ gnunet/src/integration-tests/test_integration_reconnect_nat.py.in   
2013-12-17 15:32:54 UTC (rev 31482)
@@ -0,0 +1,225 @@
address@hidden@
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# 
+import sys
+import os
+import subprocess
+import re
+import shutil
+import time
+import signal
+from gnunet_testing import Peer
+from gnunet_testing import Test
+from gnunet_testing import Check
+from gnunet_testing import Condition
+from gnunet_testing import * 
+ 
+
+#
+# This test tests if a fresh peer bootstraps from a hostlist server and then
+# successfully connects to the server. When both peers are connected
+# in transport, core, topology, fs, botth peers are shutdown and restarted 
+#
+# Conditions for successful exit:
+# Both peers have 1 connected peer in transport, core, topology, fs after 
restart
+
+#definitions
+
+
+testname = "test_integration_restart"
+verbose = True
+check_timeout = 180
+
+if os.name == "nt":
+  tmp = os.getenv ("TEMP")
+else:
+  tmp = "/tmp"
+
+def cleanup ():
+    retries = 10
+    path = os.path.join (tmp, "c_bootstrap_server")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path) 
+        
+    
+    retries = 10
+    path = os.path.join (tmp, "c_nat_client")  
+    test.p ("Removing " + path)      
+    while ((os.path.exists(path)) and (retries > 0)):
+        shutil.rmtree ((path), False)
+        time.sleep (1)
+        retries -= 1
+    if (os.path.exists(path)):
+        test.p ("Failed to remove " + path) 
+
+def success_restart_cont (check):
+       global success 
+       print 'Peers connected successfully after restart'
+       server.stop ()
+       client.stop ()
+       success = True; 
+
+
+def fail_restart_cont (check):    
+       global success 
+       success = False;
+       print 'Peers failed to connect after restart'
+       check.evaluate(True)   
+    
+
+def success_connect_cont (check):
+       print 'Peers connected successfully'
+       server.stop ()
+       client.stop ()
+       
+       time.sleep(5)
+       
+       test.p ('Restarting client & server')
+       server.start ()
+       client.start ()
+       
+       check = Check (test)
+       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
+       
+       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
+       
+       check.run_blocking (check_timeout, success_restart_cont, 
fail_restart_cont)
+
+
+def fail_connect_cont (check):    
+       global success 
+       success= False;
+       print 'Peers failed to connect'
+       check.evaluate(True)
+
+
+def check_connect ():
+       check = Check (test)
+       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
+       
+       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
+       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
+       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
+       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
+       
+       check.run_blocking (check_timeout, success_connect_cont, 
fail_connect_cont)
+
+# 
+# Test execution
+# 
+
+
+def SigHandler(signum = None, frame = None):
+       global success  
+       global server
+       global client  
+       
+       print 'Test was aborted!'
+       if (None != server):
+               server.stop ()
+       if (None != server):            
+               client.stop ()
+       cleanup ()
+       sys.exit(success)
+
+def run ():
+       global success
+       global test
+       global server
+       global client
+       
+       success = False
+       server = None
+       client = None   
+
+       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
+               signal.signal(sig, SigHandler)
+       
+       
+       test = Test ('test_integration_disconnect', verbose)
+       cleanup ()
+       server = Peer(test, './confs/c_bootstrap_server.conf');
+       server.start();
+       
+       client = Peer(test, './confs/c_nat_client.conf');
+       client.start();
+       
+
+       if (True != server.start()):
+               print 'Failed to start server'
+               if (None != server):
+                       server.stop ()
+               if (None != server):            
+                       client.stop ()
+               cleanup ()
+               sys.exit(success)
+       if (True != client.start()):
+               print 'Failed to start client'
+               if (None != server):
+                       server.stop ()
+               if (None != server):            
+                       client.stop ()
+               cleanup ()
+               sys.exit(success)
+       
+       check_connect ()
+       
+       server.stop ()    
+       client.stop ()
+       cleanup ()
+       
+       if (success == False):
+               print ('Test failed')
+               return True
+       else:
+               return False
+
+       
+try:
+    run ()
+except (KeyboardInterrupt, SystemExit):    
+    print 'Test interrupted'
+    server.stop ()
+    client.stop ()
+    cleanup ()
+if (success == False):
+       sys.exit(1)   
+else:
+       sys.exit(0)    
+
+       
\ No newline at end of file


Property changes on: 
gnunet/src/integration-tests/test_integration_reconnect_nat.py.in
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Deleted: gnunet/src/integration-tests/test_integration_restart.py.in
===================================================================
--- gnunet/src/integration-tests/test_integration_restart.py.in 2013-12-17 
15:00:28 UTC (rev 31481)
+++ gnunet/src/integration-tests/test_integration_restart.py.in 2013-12-17 
15:32:54 UTC (rev 31482)
@@ -1,225 +0,0 @@
address@hidden@
-#    This file is part of GNUnet.
-#    (C) 2010 Christian Grothoff (and other contributing authors)
-#
-#    GNUnet is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published
-#    by the Free Software Foundation; either version 2, or (at your
-#    option) any later version.
-#
-#    GNUnet is distributed in the hope that it will be useful, but
-#    WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#    General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with GNUnet; see the file COPYING.  If not, write to the
-#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-#    Boston, MA 02111-1307, USA.
-#
-# 
-import sys
-import os
-import subprocess
-import re
-import shutil
-import time
-import signal
-from gnunet_testing import Peer
-from gnunet_testing import Test
-from gnunet_testing import Check
-from gnunet_testing import Condition
-from gnunet_testing import * 
- 
-
-#
-# This test tests if a fresh peer bootstraps from a hostlist server and then
-# successfully connects to the server. When both peers are connected
-# in transport, core, topology, fs, botth peers are shutdown and restarted 
-#
-# Conditions for successful exit:
-# Both peers have 1 connected peer in transport, core, topology, fs after 
restart
-
-#definitions
-
-
-testname = "test_integration_restart"
-verbose = True
-check_timeout = 180
-
-if os.name == "nt":
-  tmp = os.getenv ("TEMP")
-else:
-  tmp = "/tmp"
-
-def cleanup ():
-    retries = 10
-    path = os.path.join (tmp, "c_bootstrap_server")  
-    test.p ("Removing " + path)      
-    while ((os.path.exists(path)) and (retries > 0)):
-        shutil.rmtree ((path), False)
-        time.sleep (1)
-        retries -= 1
-    if (os.path.exists(path)):
-        test.p ("Failed to remove " + path) 
-        
-    
-    retries = 10
-    path = os.path.join (tmp, "c_no_nat_client")  
-    test.p ("Removing " + path)      
-    while ((os.path.exists(path)) and (retries > 0)):
-        shutil.rmtree ((path), False)
-        time.sleep (1)
-        retries -= 1
-    if (os.path.exists(path)):
-        test.p ("Failed to remove " + path) 
-
-def success_restart_cont (check):
-       global success 
-       print 'Peers connected successfully after restart'
-       server.stop ()
-       client.stop ()
-       success = True; 
-
-
-def fail_restart_cont (check):    
-       global success 
-       success = False;
-       print 'Peers failed to connect after restart'
-       check.evaluate(True)   
-    
-
-def success_connect_cont (check):
-       print 'Peers connected successfully'
-       server.stop ()
-       client.stop ()
-       
-       time.sleep(5)
-       
-       test.p ('Restarting client & server')
-       server.start ()
-       client.start ()
-       
-       check = Check (test)
-       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
-       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
-       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
-       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
-       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
-       
-       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
-       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
-       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
-       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
-       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
-       
-       check.run_blocking (check_timeout, success_restart_cont, 
fail_restart_cont)
-
-
-def fail_connect_cont (check):    
-       global success 
-       success= False;
-       print 'Peers failed to connect'
-       check.evaluate(True)
-
-
-def check_connect ():
-       check = Check (test)
-       check.add (StatisticsCondition (client, 'transport', '# peers 
connected',1))
-       check.add (StatisticsCondition (client, 'core', '# neighbour entries 
allocated',1))  
-       check.add (StatisticsCondition (client, 'core', '# peers connected',1))
-       check.add (StatisticsCondition (client, 'topology', '# peers 
connected',1))
-       check.add (StatisticsCondition (client, 'fs', '# peers connected',1))
-       
-       check.add (StatisticsCondition (server, 'transport', '# peers 
connected',1))
-       check.add (StatisticsCondition (server, 'core', '# neighbour entries 
allocated',1))  
-       check.add (StatisticsCondition (server, 'core', '# peers connected',1))
-       check.add (StatisticsCondition (server, 'topology', '# peers 
connected',1))
-       check.add (StatisticsCondition (server, 'fs', '# peers connected',1))  
-       
-       check.run_blocking (check_timeout, success_connect_cont, 
fail_connect_cont)
-
-# 
-# Test execution
-# 
-
-
-def SigHandler(signum = None, frame = None):
-       global success  
-       global server
-       global client  
-       
-       print 'Test was aborted!'
-       if (None != server):
-               server.stop ()
-       if (None != server):            
-               client.stop ()
-       cleanup ()
-       sys.exit(success)
-
-def run ():
-       global success
-       global test
-       global server
-       global client
-       
-       success = False
-       server = None
-       client = None   
-
-       for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, 
signal.SIGQUIT]:
-               signal.signal(sig, SigHandler)
-       
-       
-       test = Test ('test_integration_disconnect', verbose)
-       cleanup ()
-       server = Peer(test, './confs/c_bootstrap_server.conf');
-       server.start();
-       
-       client = Peer(test, './confs/c_no_nat_client.conf');
-       client.start();
-       
-
-       if (True != server.start()):
-               print 'Failed to start server'
-               if (None != server):
-                       server.stop ()
-               if (None != server):            
-                       client.stop ()
-               cleanup ()
-               sys.exit(success)
-       if (True != client.start()):
-               print 'Failed to start client'
-               if (None != server):
-                       server.stop ()
-               if (None != server):            
-                       client.stop ()
-               cleanup ()
-               sys.exit(success)
-       
-       check_connect ()
-       
-       server.stop ()    
-       client.stop ()
-       cleanup ()
-       
-       if (success == False):
-               print ('Test failed')
-               return True
-       else:
-               return False
-
-       
-try:
-    run ()
-except (KeyboardInterrupt, SystemExit):    
-    print 'Test interrupted'
-    server.stop ()
-    client.stop ()
-    cleanup ()
-if (success == False):
-       sys.exit(1)   
-else:
-       sys.exit(0)    
-
-       
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]