@@ -143,6 +143,66 @@ func TestMultiNodeMetrics_NodeTransitions(t *testing.T) {
143143 }
144144}
145145
146+ func TestMultiNodeMetrics_LifecycleMetrics (t * testing.T ) {
147+ m := setupTestMultiNodeMetrics (t )
148+ ctx := context .Background ()
149+ nodeName := "node-1"
150+
151+ t .Run ("SetHighestSeenBlock" , func (t * testing.T ) {
152+ m .SetHighestSeenBlock (ctx , nodeName , 123 )
153+ require .InEpsilon (t ,
154+ 123.0 ,
155+ testutil .ToFloat64 (promPoolRPCNodeHighestSeenBlock .WithLabelValues ("test-network" , "1" , nodeName )),
156+ 0.001 ,
157+ )
158+ })
159+
160+ t .Run ("SetHighestFinalizedBlock" , func (t * testing.T ) {
161+ m .SetHighestFinalizedBlock (ctx , nodeName , 456 )
162+ require .InEpsilon (t ,
163+ 456.0 ,
164+ testutil .ToFloat64 (promPoolRPCNodeHighestFinalizedBlock .WithLabelValues ("test-network" , "1" , nodeName )),
165+ 0.001 ,
166+ )
167+ })
168+
169+ t .Run ("IncrementSeenBlocks" , func (t * testing.T ) {
170+ m .IncrementSeenBlocks (ctx , nodeName )
171+ require .InEpsilon (t ,
172+ 1.0 ,
173+ testutil .ToFloat64 (promPoolRPCNodeNumSeenBlocks .WithLabelValues ("test-network" , "1" , nodeName )),
174+ 0.001 ,
175+ )
176+ })
177+
178+ t .Run ("IncrementPolls" , func (t * testing.T ) {
179+ m .IncrementPolls (ctx , nodeName )
180+ require .InEpsilon (t ,
181+ 1.0 ,
182+ testutil .ToFloat64 (promPoolRPCNodePolls .WithLabelValues ("test-network" , "1" , nodeName )),
183+ 0.001 ,
184+ )
185+ })
186+
187+ t .Run ("IncrementPollsFailed" , func (t * testing.T ) {
188+ m .IncrementPollsFailed (ctx , nodeName )
189+ require .InEpsilon (t ,
190+ 1.0 ,
191+ testutil .ToFloat64 (promPoolRPCNodePollsFailed .WithLabelValues ("test-network" , "1" , nodeName )),
192+ 0.001 ,
193+ )
194+ })
195+
196+ t .Run ("IncrementPollsSuccess" , func (t * testing.T ) {
197+ m .IncrementPollsSuccess (ctx , nodeName )
198+ require .InEpsilon (t ,
199+ 1.0 ,
200+ testutil .ToFloat64 (promPoolRPCNodePollsSuccess .WithLabelValues ("test-network" , "1" , nodeName )),
201+ 0.001 ,
202+ )
203+ })
204+ }
205+
146206func TestMultiNodeMetrics_IncrementInvariantViolations (t * testing.T ) {
147207 m := setupTestMultiNodeMetrics (t )
148208 ctx := context .Background ()
0 commit comments