@@ -5,9 +5,9 @@ package hiero
55// SPDX-License-Identifier: Apache-2.0
66
77import (
8- "fmt"
98 "net"
109 "testing"
10+ "time"
1111
1212 "github.com/stretchr/testify/require"
1313)
@@ -52,8 +52,6 @@ func createRegisteredNode(t *testing.T, client *Client, adminKey PrivateKey) uin
5252 require .NoError (t , err )
5353
5454 require .Greater (t , createReceipt .RegisteredNodeId , uint64 (0 ), "registeredNodeId should be non-zero" )
55- t .Log (createReceipt .RegisteredNodeId )
56- fmt .Println (createReceipt )
5755 return createReceipt .RegisteredNodeId
5856}
5957
@@ -80,7 +78,16 @@ func TestIntegrationRegisteredNodeUpdateTransactionUpdateDescription(t *testing.
8078 _ , err = updateResp .SetValidateStatus (true ).GetReceipt (client )
8179 require .NoError (t , err )
8280
83- // TODO: query the registered node and verify description == "updated description"
81+ // Wait for mirror node propagation
82+ time .Sleep (5 * time .Second )
83+
84+ // Query the registered node and verify description was updated
85+ book , err := NewRegisteredNodeAddressBookQuery ().
86+ SetRegisteredNodeId (registeredNodeId ).
87+ Execute (client )
88+ require .NoError (t , err )
89+ require .Len (t , book .RegisteredNodes , 1 )
90+ require .Equal (t , "updated description" , book .RegisteredNodes [0 ].Description )
8491}
8592
8693func TestIntegrationRegisteredNodeUpdateTransactionReplaceEndpoints (t * testing.T ) {
@@ -110,7 +117,22 @@ func TestIntegrationRegisteredNodeUpdateTransactionReplaceEndpoints(t *testing.T
110117 _ , err = updateResp .SetValidateStatus (true ).GetReceipt (client )
111118 require .NoError (t , err )
112119
113- // TODO: query the registered node and verify endpoints were replaced
120+ // Wait for mirror node propagation
121+ time .Sleep (5 * time .Second )
122+
123+ // Query the registered node and verify endpoints were replaced
124+ book , err := NewRegisteredNodeAddressBookQuery ().
125+ SetRegisteredNodeId (registeredNodeId ).
126+ Execute (client )
127+ require .NoError (t , err )
128+ require .Len (t , book .RegisteredNodes , 1 )
129+ require .Len (t , book .RegisteredNodes [0 ].ServiceEndpoints , 1 )
130+
131+ ep , ok := book .RegisteredNodes [0 ].ServiceEndpoints [0 ].(* BlockNodeServiceEndpoint )
132+ require .True (t , ok , "expected *BlockNodeServiceEndpoint" )
133+ require .Equal (t , net .IPv4 (172 , 16 , 0 , 1 ).To4 (), net .IP (ep .GetIPAddress ()))
134+ require .Equal (t , uint32 (9090 ), ep .GetPort ())
135+ require .Equal (t , []BlockNodeApi {BlockNodeApiPublish }, ep .GetEndpointApis ())
114136}
115137
116138func TestIntegrationRegisteredNodeUpdateTransactionUpdateAdminKeyBothSign (t * testing.T ) {
@@ -142,7 +164,16 @@ func TestIntegrationRegisteredNodeUpdateTransactionUpdateAdminKeyBothSign(t *tes
142164 _ , err = updateResp .SetValidateStatus (true ).GetReceipt (client )
143165 require .NoError (t , err )
144166
145- // TODO: query the registered node and verify admin key was updated to newAdminKey
167+ // Wait for mirror node propagation
168+ time .Sleep (5 * time .Second )
169+
170+ // Query the registered node and verify admin key was updated
171+ book , err := NewRegisteredNodeAddressBookQuery ().
172+ SetRegisteredNodeId (registeredNodeId ).
173+ Execute (client )
174+ require .NoError (t , err )
175+ require .Len (t , book .RegisteredNodes , 1 )
176+ require .Equal (t , newAdminKey .PublicKey ().String (), book .RegisteredNodes [0 ].AdminKey .String ())
146177}
147178
148179func TestIntegrationRegisteredNodeUpdateTransactionUpdateAdminKeyOnlyOldSigns (t * testing.T ) {
@@ -223,5 +254,20 @@ func TestIntegrationRegisteredNodeUpdateTransactionReplaceDomainEndpoint(t *test
223254 _ , err = updateResp .SetValidateStatus (true ).GetReceipt (client )
224255 require .NoError (t , err )
225256
226- // TODO: query the registered node and verify endpoint uses domain name "node.example.com"
257+ // Wait for mirror node propagation
258+ time .Sleep (5 * time .Second )
259+
260+ // Query the registered node and verify endpoint uses domain name
261+ book , err := NewRegisteredNodeAddressBookQuery ().
262+ SetRegisteredNodeId (registeredNodeId ).
263+ Execute (client )
264+ require .NoError (t , err )
265+ require .Len (t , book .RegisteredNodes , 1 )
266+ require .Len (t , book .RegisteredNodes [0 ].ServiceEndpoints , 1 )
267+
268+ ep , ok := book .RegisteredNodes [0 ].ServiceEndpoints [0 ].(* BlockNodeServiceEndpoint )
269+ require .True (t , ok , "expected *BlockNodeServiceEndpoint" )
270+ require .Equal (t , "node.example.com" , ep .GetDomainName ())
271+ require .Equal (t , uint32 (443 ), ep .GetPort ())
272+ require .Equal (t , []BlockNodeApi {BlockNodeApiStatus }, ep .GetEndpointApis ())
227273}
0 commit comments