@@ -95,3 +95,89 @@ func makeNodes(n int, phase seiv1alpha1.SeiNodePhase) []seiv1alpha1.SeiNode {
9595 }
9696 return nodes
9797}
98+
99+ // --- NetworkingStatus ---
100+
101+ func TestBuildNetworkingStatus_FullMode_DualDomain (t * testing.T ) {
102+ g := NewWithT (t )
103+ group := newTestGroup ("pacific-1-wave" , "pacific-1" )
104+ group .Spec .Networking = & seiv1alpha1.NetworkingConfig {
105+ Service : & seiv1alpha1.ExternalServiceConfig {},
106+ }
107+
108+ r := & SeiNodeDeploymentReconciler {
109+ GatewayDomain : "prod.platform.sei.io" ,
110+ GatewayPublicDomain : "platform.sei.io" ,
111+ }
112+ status := r .buildNetworkingStatus (group )
113+
114+ g .Expect (status ).NotTo (BeNil ())
115+ g .Expect (status .Routes ).To (HaveLen (8 ))
116+
117+ hostnames := make ([]string , len (status .Routes ))
118+ for i , r := range status .Routes {
119+ hostnames [i ] = r .Hostname
120+ }
121+ g .Expect (hostnames ).To (ContainElements (
122+ "pacific-1-wave-evm.prod.platform.sei.io" ,
123+ "pacific-1-wave-evm.pacific-1.platform.sei.io" ,
124+ "pacific-1-wave-rpc.prod.platform.sei.io" ,
125+ "pacific-1-wave-rpc.pacific-1.platform.sei.io" ,
126+ ))
127+
128+ for _ , rs := range status .Routes {
129+ g .Expect (rs .Protocol ).NotTo (BeEmpty ())
130+ }
131+ }
132+
133+ func TestBuildNetworkingStatus_SingleDomain (t * testing.T ) {
134+ g := NewWithT (t )
135+ group := newTestGroup ("pacific-1-wave" , "pacific-1" )
136+ group .Spec .Networking = & seiv1alpha1.NetworkingConfig {
137+ Service : & seiv1alpha1.ExternalServiceConfig {},
138+ }
139+
140+ r := & SeiNodeDeploymentReconciler {
141+ GatewayDomain : "dev.platform.sei.io" ,
142+ }
143+ status := r .buildNetworkingStatus (group )
144+
145+ g .Expect (status ).NotTo (BeNil ())
146+ g .Expect (status .Routes ).To (HaveLen (4 ))
147+ for _ , rs := range status .Routes {
148+ g .Expect (rs .Hostname ).To (HaveSuffix (".dev.platform.sei.io" ))
149+ }
150+ }
151+
152+ func TestBuildNetworkingStatus_ValidatorMode_Nil (t * testing.T ) {
153+ g := NewWithT (t )
154+ group := newTestGroup ("pacific-1-val" , "pacific-1" )
155+ group .Spec .Template .Spec .FullNode = nil
156+ group .Spec .Template .Spec .Validator = & seiv1alpha1.ValidatorSpec {}
157+
158+ r := & SeiNodeDeploymentReconciler {
159+ GatewayDomain : "prod.platform.sei.io" ,
160+ GatewayPublicDomain : "platform.sei.io" ,
161+ }
162+ status := r .buildNetworkingStatus (group )
163+ g .Expect (status ).To (BeNil ())
164+ }
165+
166+ func TestBuildNetworkingStatus_ProtocolValues (t * testing.T ) {
167+ g := NewWithT (t )
168+ group := newTestGroup ("pacific-1-wave" , "pacific-1" )
169+ group .Spec .Networking = & seiv1alpha1.NetworkingConfig {
170+ Service : & seiv1alpha1.ExternalServiceConfig {},
171+ }
172+
173+ r := & SeiNodeDeploymentReconciler {
174+ GatewayDomain : "prod.platform.sei.io" ,
175+ }
176+ status := r .buildNetworkingStatus (group )
177+
178+ protocols := make ([]string , len (status .Routes ))
179+ for i , rs := range status .Routes {
180+ protocols [i ] = rs .Protocol
181+ }
182+ g .Expect (protocols ).To (ConsistOf ("evm" , "rpc" , "rest" , "grpc" ))
183+ }
0 commit comments