-more
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 8 Dec 2011 17:22:03 +0000 (17:22 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 8 Dec 2011 17:22:03 +0000 (17:22 +0000)
src/integration-tests/confs/c_no_nat_client.conf
src/integration-tests/hostkeys/0000-hostkey [new file with mode: 0644]
src/integration-tests/hostkeys/0001-hostkey [new file with mode: 0644]
src/integration-tests/test_integration_bootstrap_and_connect.py.in

index 908212c18344dbcb9dae10a0fb54f2014c7284e0..e103ba8fe2198b57204780ea4219f2b136c51025 100644 (file)
@@ -132,6 +132,7 @@ ATS_MIN_INTERVAL = 15000
 ATS_EXEC_INTERVAL = 30000
 
 [transport]
+#DEBUG = YES
 AUTOSTART = YES
 PORT = 20029
 HOSTNAME = localhost
@@ -274,7 +275,7 @@ HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data
 CONFIG = $DEFAULTCONFIG
 BINARY = gnunet-daemon-hostlist
 OPTIONS = -b
-SERVERS = http://v9.gnunet.org:58080/
+SERVERS = http://localhost:8080/
 HTTP-PROXY = 
 
 [core]
diff --git a/src/integration-tests/hostkeys/0000-hostkey b/src/integration-tests/hostkeys/0000-hostkey
new file mode 100644 (file)
index 0000000..c3c2123
Binary files /dev/null and b/src/integration-tests/hostkeys/0000-hostkey differ
diff --git a/src/integration-tests/hostkeys/0001-hostkey b/src/integration-tests/hostkeys/0001-hostkey
new file mode 100644 (file)
index 0000000..871fc90
Binary files /dev/null and b/src/integration-tests/hostkeys/0001-hostkey differ
index 44e8df3df1cede0568cb7bed75fd52a8853006b4..e88c2988a9d5667ad7872b08fa27e7ead88954c2 100755 (executable)
@@ -23,6 +23,7 @@ import os
 import subprocess
 import re
 import shutil
+import time
 
 #
 # This test tests if a fresh peer bootstraps from a hostlist server and then
@@ -31,80 +32,102 @@ import shutil
 
 #definitions
 
-def vpfrint (msg):
-    if verbose == True:
-        print msg
-
-
 testname = "test_integration_bootstrap_and_connect"
 verbose = True
+gnunetarm = ""
+#fix this!
+success = True
+timeout = 2
 
-# setup
-
-srcdir = "../.."
-gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
-if gnunet_pyexpect_dir not in sys.path:
-  sys.path.append (gnunet_pyexpect_dir)
-
-from gnunet_pyexpect import pexpect
-
-if os.name == 'posix':
-  gnunetarm = 'gnunet-arm'
-elif os.name == 'nt':
-  gnunetarm = 'gnunet-arm.exe'
-
-if os.name == "nt":
-  shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
-else:
-  shutil.rmtree ("/tmp/" + testname, True)
-
-vpfrint ("Running " + testname)
+def vprintf (msg):
+    if verbose == True:
+        print msg
 
+def setup ():
+       srcdir = "../.."
+       gnunet_pyexpect_dir = os.path.join (srcdir, "contrib")
+       if gnunet_pyexpect_dir not in sys.path:
+         sys.path.append (gnunet_pyexpect_dir)
+       
+       from gnunet_pyexpect import pexpect
+
+       global gnunetarm        
+       if os.name == 'posix':
+         gnunetarm = 'gnunet-arm'
+       elif os.name == 'nt':
+         gnunetarm = 'gnunet-arm.exe'
+       
+       if os.name == "nt":
+         shutil.rmtree (os.path.join (os.getenv ("TEMP"), testname), True)
+       else:
+         shutil.rmtree ("/tmp/" + testname, True)
+
+def start ():
+       vprintf ("Starting bootstrap server & client")
+       try:
+           server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf'])
+           server.communicate ()    
+       except OSError:
+           print "Can not start bootstrap server, exiting..."
+           exit (1)
+       try:
+           client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf'])
+           client.communicate ()    
+       except OSError:
+           print "Can not start bootstrap client, exiting..."
+           exit (1)
+       vprintf ("Bootstrap server & client started")
+
+def stop ():
+       vprintf ("Shutting down bootstrap server")
+       try:
+           server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf'])
+           server.communicate ()    
+       except OSError:
+           print "Can not stop bootstrap server, exiting..."
+           exit (1)
+       try:
+           client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf'])
+           client.communicate ()    
+       except OSError:
+           print "Can not stop bootstrap client, exiting..."
+           exit (1)
+       vprintf ("Bootstrap server & client stopped")
+
+
+def cleanup ():
+       if os.name == "nt":
+           shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True)
+       else:
+           shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True)
+
+def check ():
+       global success
+       global timeout
+       count = 1
+
+       while ((success == False) and (count < timeout)):
+               time.sleep(1)
+               count += 1 
 
+# 
+# Test execution
+# 
 
-# start nodes
+vprintf ("Running " + testname)
+setup ()
+start ()
 
-vpfrint ("Starting bootstrap server & client")
-try:
-    server = subprocess.Popen ([gnunetarm, '-sq', '-c', './confs/c_bootstrap_server.conf'])
-    server.communicate ()    
-except OSError:
-    print "Can not start bootstrap server, exiting..."
-    exit (1)
-try:
-    client = subprocess.Popen ([gnunetarm, '-sq', '-c', 'confs/c_no_nat_client.conf'])
-    client.communicate ()    
-except OSError:
-    print "Can not start bootstrap client, exiting..."
-    exit (1)
-vpfrint ("Bootstrap server & client started")
+check ()
 
+stop ()
+cleanup ()
 
-import time
-time.sleep(5)
-
-# shutdown
-vpfrint ("Shutting down bootstrap server")
-try:
-    server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf'])
-    server.communicate ()    
-except OSError:
-    print "Can not stop bootstrap server, exiting..."
-    exit (1)
-try:
-    client = subprocess.Popen ([gnunetarm, '-eq', '-c', 'confs/c_no_nat_client.conf'])
-    client.communicate ()    
-except OSError:
-    print "Can not stop bootstrap client, exiting..."
-    exit (1)
-vpfrint ("Bootstrap server & client stopped")
-
-# clean up
-
-if os.name == "nt":
-    shutil.rmtree (os.path.join (os.getenv ("TEMP"), "gnunet-test-fs-py-ns"), True)
+if (success == False):
+       print ('Test failed')
+       exit (1)
 else:
-    shutil.rmtree ("/tmp/gnunet-test-fs-py-ns", True)
+       print ('Test successful')
+       exit (0)
 
-exit (0)