github.com/kotalco/kotal@v0.3.0/clients/ethereum2/nimbus_validator_client_test.go (about)

     1  package ethereum2
     2  
     3  import (
     4  	"fmt"
     5  
     6  	ethereum2v1alpha1 "github.com/kotalco/kotal/apis/ethereum2/v1alpha1"
     7  	sharedAPI "github.com/kotalco/kotal/apis/shared"
     8  	"github.com/kotalco/kotal/controllers/shared"
     9  	. "github.com/onsi/ginkgo/v2"
    10  	. "github.com/onsi/gomega"
    11  )
    12  
    13  var _ = Describe("Nimbus validator client", func() {
    14  	validator := &ethereum2v1alpha1.Validator{
    15  		Spec: ethereum2v1alpha1.ValidatorSpec{
    16  			Client:          ethereum2v1alpha1.NimbusClient,
    17  			Network:         "mainnet",
    18  			BeaconEndpoints: []string{"http://nimbus-beacon-node"},
    19  			Graffiti:        "Validated by Kotal",
    20  			Keystores: []ethereum2v1alpha1.Keystore{
    21  				{
    22  					SecretName: "my-validator",
    23  				},
    24  			},
    25  			FeeRecipient: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    26  			Logging:      sharedAPI.FatalLogs,
    27  		},
    28  	}
    29  
    30  	validator.Default()
    31  	client, _ := NewClient(validator)
    32  
    33  	It("Should get correct command", func() {
    34  		Expect(client.Command()).To(ConsistOf("nimbus_validator_client"))
    35  	})
    36  
    37  	It("Should get correct env", func() {
    38  		Expect(client.Env()).To(BeNil())
    39  	})
    40  
    41  	It("Should get correct home dir", func() {
    42  		Expect(client.HomeDir()).To(Equal(NimbusHomeDir))
    43  	})
    44  
    45  	It("Should generate correct client arguments", func() {
    46  
    47  		args := client.Args()
    48  
    49  		Expect(args).To(ContainElements([]string{
    50  			NimbusNonInteractive,
    51  			argWithVal(NimbusLogging, string(validator.Spec.Logging)),
    52  			argWithVal(NimbusDataDir, shared.PathData(client.HomeDir())),
    53  			argWithVal(NimbusBeaconNodes, "http://nimbus-beacon-node"),
    54  			argWithVal(NimbusGraffiti, "Validated by Kotal"),
    55  			argWithVal(NimbusValidatorsDir, fmt.Sprintf("%s/kotal-validators/validator-keys", shared.PathData(client.HomeDir()))),
    56  			argWithVal(NimbusSecretsDir, fmt.Sprintf("%s/kotal-validators/validator-secrets", shared.PathData(client.HomeDir()))),
    57  			argWithVal(NimbusFeeRecipient, "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"),
    58  		}))
    59  
    60  	})
    61  
    62  })