2
2
3
3
import os
4
4
from enum import Enum , auto , unique
5
- from time import sleep
6
5
7
6
# The base class exists inside the commander container
8
7
from commander import Commander
@@ -23,18 +22,7 @@ def set_test_params(self):
23
22
# This is just a minimum
24
23
self .num_nodes = 10
25
24
26
- def add_options (self , parser ):
27
- parser .add_argument (
28
- "--network_name" ,
29
- dest = "network_name" ,
30
- default = "warnet" ,
31
- help = "" ,
32
- )
33
-
34
25
def run_test (self ):
35
- while not self .warnet .network_connected ():
36
- sleep (1 )
37
-
38
26
# All permutations of a directed acyclic graph with zero, one, or two inputs/outputs
39
27
#
40
28
# │ Node │ In │ Out │ Con In │ Con Out │
@@ -66,12 +54,6 @@ def run_test(self):
66
54
self .connect_nodes (5 , 4 )
67
55
self .connect_nodes (5 , 6 )
68
56
self .connect_nodes (6 , 7 )
69
-
70
- # Nodes 8 & 9 shall come pre-connected. Attempt to connect them anyway to test the handling
71
- # of dns node addresses
72
- self .connect_nodes (8 , 9 )
73
- self .connect_nodes (9 , 8 )
74
-
75
57
self .sync_all ()
76
58
77
59
zero_peers = self .nodes [0 ].getpeerinfo ()
@@ -85,31 +67,29 @@ def run_test(self):
85
67
eight_peers = self .nodes [8 ].getpeerinfo ()
86
68
nine_peers = self .nodes [9 ].getpeerinfo ()
87
69
88
- for tank in self .warnet .tanks :
89
- self .log .info (
90
- f"Tank { tank .index } : { tank .warnet .tanks [tank .index ].get_dns_addr ()} pod:"
91
- f" { tank .warnet .tanks [tank .index ].get_ip_addr ()} "
92
- )
70
+ for node in self .nodes :
71
+ self .log .info (f"Node { node .index } : tank={ node .tank } ip={ node .rpchost } " )
93
72
94
- self .assert_connection (zero_peers , 2 , ConnectionType .DNS )
95
- self .assert_connection (one_peers , 2 , ConnectionType .DNS )
96
- self .assert_connection (one_peers , 3 , ConnectionType .DNS )
73
+ self .assert_connection (zero_peers , 2 , ConnectionType .IP )
74
+ self .assert_connection (one_peers , 2 , ConnectionType .IP )
75
+ self .assert_connection (one_peers , 3 , ConnectionType .IP )
97
76
self .assert_connection (two_peers , 0 , ConnectionType .IP )
98
77
self .assert_connection (two_peers , 1 , ConnectionType .IP )
99
- self .assert_connection (two_peers , 3 , ConnectionType .DNS )
100
- self .assert_connection (two_peers , 4 , ConnectionType .DNS )
78
+ self .assert_connection (two_peers , 3 , ConnectionType .IP )
79
+ self .assert_connection (two_peers , 4 , ConnectionType .IP )
101
80
self .assert_connection (three_peers , 1 , ConnectionType .IP )
102
81
self .assert_connection (three_peers , 2 , ConnectionType .IP )
103
- self .assert_connection (three_peers , 5 , ConnectionType .DNS )
82
+ self .assert_connection (three_peers , 5 , ConnectionType .IP )
104
83
self .assert_connection (four_peers , 2 , ConnectionType .IP )
105
84
self .assert_connection (four_peers , 5 , ConnectionType .IP )
106
85
self .assert_connection (five_peers , 3 , ConnectionType .IP )
107
- self .assert_connection (five_peers , 4 , ConnectionType .DNS )
108
- self .assert_connection (five_peers , 6 , ConnectionType .DNS )
86
+ self .assert_connection (five_peers , 4 , ConnectionType .IP )
87
+ self .assert_connection (five_peers , 6 , ConnectionType .IP )
109
88
self .assert_connection (six_peers , 5 , ConnectionType .IP )
110
- self .assert_connection (six_peers , 7 , ConnectionType .DNS )
89
+ self .assert_connection (six_peers , 7 , ConnectionType .IP )
111
90
self .assert_connection (seven_peers , 6 , ConnectionType .IP )
112
91
# Check the pre-connected nodes
92
+ # The only connection made by DNS name would be from the initial graph edges
113
93
self .assert_connection (eight_peers , 9 , ConnectionType .DNS )
114
94
self .assert_connection (nine_peers , 8 , ConnectionType .IP )
115
95
@@ -121,14 +101,15 @@ def run_test(self):
121
101
def assert_connection (self , connector , connectee_index , connection_type : ConnectionType ):
122
102
if connection_type == ConnectionType .DNS :
123
103
assert any (
124
- d .get ("addr" ) == self .warnet .tanks [connectee_index ].get_dns_addr ()
104
+ # ignore the ...-service suffix
105
+ self .nodes [connectee_index ].tank in d .get ("addr" )
125
106
for d in connector
126
- ), f "Could not find { self . options . network_name } -tank-00000 { connectee_index } -service "
107
+ ), "Could not find conectee hostname "
127
108
elif connection_type == ConnectionType .IP :
128
109
assert any (
129
- d .get ("addr" ).split (":" )[0 ] == self .warnet . tanks [connectee_index ].get_ip_addr ()
110
+ d .get ("addr" ).split (":" )[0 ] == self .nodes [connectee_index ].rpchost
130
111
for d in connector
131
- ), f "Could not find Tank { connectee_index } 's ip addr"
112
+ ), "Could not find connectee ip addr"
132
113
else :
133
114
raise ValueError ("ConnectionType must be of type DNS or IP" )
134
115
0 commit comments