@@ -537,3 +537,149 @@ func TestE2E_InvalidArgs_NegativeNodeID(t *testing.T) {
537537 // Run test case
538538 e2eTest .run ()
539539}
540+
541+ func TestE2E_ValidArgs_NodeOperatorID_Mainnet (t * testing.T ) {
542+ // t.Parallel()
543+ // Test context
544+ var (
545+ cmd * exec.Cmd
546+ )
547+ // Build test case
548+ e2eTest := newE2ELidoExporterTestCase (
549+ t ,
550+ // Arrange
551+ nil ,
552+ // Act
553+ func (t * testing.T , binaryPath string ) * exec.Cmd {
554+ cmd = base .RunCommandCMD (t , binaryPath , "lido-exporter" , "lido-exporter" , "--node-operator-id" , "1" , "--network" , "mainnet" , "--port" , "9980" )
555+ time .Sleep (2 * time .Second )
556+ return cmd
557+ },
558+ // Assert
559+ func (t * testing.T ) {
560+ checkPrometheusServerUp (t , 9980 )
561+ checkMetrics (t , 9980 )
562+
563+ cmd .Process .Signal (os .Interrupt )
564+
565+ // Wait for the process to exit with a timeout
566+ done := make (chan error , 1 )
567+ go func () {
568+ done <- cmd .Wait ()
569+ }()
570+
571+ select {
572+ case err := <- done :
573+ assert .NoError (t , err )
574+ case <- time .After (5 * time .Second ):
575+ t .Error ("Process did not exit within the timeout period" )
576+ cmd .Process .Kill () // Force kill if it doesn't exit
577+ }
578+ },
579+ )
580+ // Run test case
581+ e2eTest .run ()
582+ }
583+
584+ func TestE2E_ValidEnv_All_Mainnet (t * testing.T ) {
585+ // t.Parallel()
586+ // Test context
587+ var (
588+ cmd * exec.Cmd
589+ )
590+ // Build test case
591+ e2eTest := newE2ELidoExporterTestCase (
592+ t ,
593+ // Arrange
594+ func (t * testing.T , binaryPath string ) (map [string ]string , error ) {
595+ return map [string ]string {
596+ "LIDO_EXPORTER_RPC_ENDPOINTS" : "'https://eth.llamarpc.com','https://eth-pokt.nodies.app','https://rpc.mevblocker.io'" ,
597+ "LIDO_EXPORTER_WS_ENDPOINTS" : "'wss://ethereum-rpc.publicnode.com'" ,
598+ "LIDO_EXPORTER_PORT" : "9990" ,
599+ "LIDO_EXPORTER_SCRAPE_TIME" : "2s" ,
600+ "LIDO_EXPORTER_NETWORK" : "mainnet" ,
601+ "LIDO_EXPORTER_NODE_OPERATOR_ID" : "1" ,
602+ }, nil
603+ },
604+ // Act
605+ func (t * testing.T , binaryPath string ) * exec.Cmd {
606+ cmd = base .RunCommandCMD (t , binaryPath , "lido-exporter" , "lido-exporter" )
607+ time .Sleep (2 * time .Second )
608+ return cmd
609+ },
610+ // Assert
611+ func (t * testing.T ) {
612+ checkPrometheusServerUp (t , 9990 )
613+ checkMetrics (t , 9990 )
614+
615+ cmd .Process .Signal (os .Interrupt )
616+
617+ // Wait for the process to exit with a timeout
618+ done := make (chan error , 1 )
619+ go func () {
620+ done <- cmd .Wait ()
621+ }()
622+
623+ select {
624+ case err := <- done :
625+ assert .NoError (t , err )
626+ case <- time .After (5 * time .Second ):
627+ t .Error ("Process did not exit within the timeout period" )
628+ cmd .Process .Kill () // Force kill if it doesn't exit
629+ }
630+ },
631+ )
632+ // Run test case
633+ e2eTest .run ()
634+ }
635+
636+ func TestE2E_ValidFlags_All_Mainnet (t * testing.T ) {
637+ // t.Parallel()
638+ // Test context
639+ var (
640+ cmd * exec.Cmd
641+ )
642+ // Build test case
643+ e2eTest := newE2ELidoExporterTestCase (
644+ t ,
645+ // Arrange
646+ nil ,
647+ // Act
648+ func (t * testing.T , binaryPath string ) * exec.Cmd {
649+ cmd = base .RunCommandCMD (t , binaryPath , "lido-exporter" , "lido-exporter" ,
650+ "--rpc-endpoints" , "https://eth.llamarpc.com" , "https://eth-pokt.nodies.app" , "https://rpc.mevblocker.io" ,
651+ "--ws-endpoints" , "wss://ethereum-rpc.publicnode.com" , // https endpoint should be ignored
652+ "--port" , "9989" ,
653+ "--scrape-time" , "1s" ,
654+ "--network" , "mainnet" ,
655+ "--node-operator-id" , "1" , // should be prioritized over reward address
656+ "--reward-address" , "0x22bA5CaFB5E26E6Fe51f330294209034013A5A4c" ,
657+ )
658+ time .Sleep (2 * time .Second )
659+ return cmd
660+ },
661+ // Assert
662+ func (t * testing.T ) {
663+ checkPrometheusServerUp (t , 9989 )
664+ checkMetrics (t , 9989 )
665+
666+ cmd .Process .Signal (os .Interrupt )
667+
668+ // Wait for the process to exit with a timeout
669+ done := make (chan error , 1 )
670+ go func () {
671+ done <- cmd .Wait ()
672+ }()
673+
674+ select {
675+ case err := <- done :
676+ assert .NoError (t , err )
677+ case <- time .After (5 * time .Second ):
678+ t .Error ("Process did not exit within the timeout period" )
679+ cmd .Process .Kill () // Force kill if it doesn't exit
680+ }
681+ },
682+ )
683+ // Run test case
684+ e2eTest .run ()
685+ }
0 commit comments