2 # This file is part of GNUnet.
3 # (C) 2010 Christian Grothoff (and other contributing authors)
5 # GNUnet is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published
7 # by the Free Software Foundation; either version 2, or (at your
8 # option) any later version.
10 # GNUnet is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GNUnet; see the file COPYING. If not, write to the
17 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
22 # This test starts 3 peers and expects bootstrap and a connected clique
24 # Conditions for successful exit:
25 # Both peers have 1 connected peer in transport, core, topology, fs
33 from gnunet_testing import Peer
34 from gnunet_testing import Test
35 from gnunet_testing import Check
36 from gnunet_testing import Condition
37 from gnunet_testing import *
42 testname = "test_integration_connection_value"
49 shutil.rmtree (os.path.join (os.getenv ("TEMP"), "c_normal_client"), True)
51 shutil.rmtree ("/tmp/c_normal_client/", True)
54 def success_cont (check):
58 def fail_cont (check):
66 check.add (EqualStatisticsCondition (client, 'transport', '# peers connected', client, 'core', '# neighbour entries allocated'))
67 check.add (EqualStatisticsCondition (client, 'transport', '# peers connected', client, 'core', '# peers connected'))
68 check.add (EqualStatisticsCondition (client, 'core', '# neighbour entries allocated', client, 'core', '# peers connected'))
69 check.add (EqualStatisticsCondition (client, 'transport', '# peers connected', client, 'topology', '# peers connected'))
70 check.add (EqualStatisticsCondition (client, 'topology', '# peers connected', client, 'core', '# peers connected'))
74 res = check.run_once (None, None)
75 print "Values are equal"
76 check.evaluate (False)
92 test = Test ('test_integration_connection_value', verbose)
94 client = Peer(test, './confs/c_normal_client_tcp.conf');
97 if (client.started == True):
98 test.p ('Peers started, running check')
105 if (success == False):
106 print ('Test failed')
114 except (KeyboardInterrupt, SystemExit):
115 print 'Test interrupted'
118 if (success == False):