github.com/kotalco/kotal@v0.3.0/clients/ethereum2/prysm_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("Prysm validator client", func() {
    14  
    15  	validator := &ethereum2v1alpha1.Validator{
    16  		Spec: ethereum2v1alpha1.ValidatorSpec{
    17  			Client:          ethereum2v1alpha1.PrysmClient,
    18  			Network:         "mainnet",
    19  			BeaconEndpoints: []string{"http://localhost:8899"},
    20  			Graffiti:        "Validated by Kotal",
    21  			Keystores: []ethereum2v1alpha1.Keystore{
    22  				{
    23  					SecretName: "my-validator",
    24  				},
    25  			},
    26  			WalletPasswordSecret: "wallet-password",
    27  			FeeRecipient:         "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    28  			CertSecretName:       "my-cert",
    29  			Logging:              sharedAPI.ErrorLogs,
    30  		},
    31  	}
    32  
    33  	validator.Default()
    34  	client, _ := NewClient(validator)
    35  
    36  	It("Should get correct command", func() {
    37  		Expect(client.Command()).To(ConsistOf("validator"))
    38  	})
    39  
    40  	It("Should get correct env", func() {
    41  		Expect(client.Env()).To(BeNil())
    42  	})
    43  
    44  	It("Should get correct home dir", func() {
    45  		Expect(client.HomeDir()).To(Equal(PrysmHomeDir))
    46  	})
    47  
    48  	It("Should generate correct client arguments", func() {
    49  		args := client.Args()
    50  
    51  		Expect(args).To(ContainElements([]string{
    52  			PrysmAcceptTermsOfUse,
    53  			PrysmDataDir,
    54  			shared.PathData(client.HomeDir()),
    55  			"--mainnet",
    56  			PrysmBeaconRPCProvider,
    57  			"http://localhost:8899",
    58  			PrysmGraffiti,
    59  			"Validated by Kotal",
    60  			PrysmWalletDir,
    61  			fmt.Sprintf("%s/prysm-wallet", shared.PathData(client.HomeDir())),
    62  			PrysmWalletPasswordFile,
    63  			fmt.Sprintf("%s/prysm-wallet/prysm-wallet-password.txt", shared.PathSecrets(client.HomeDir())),
    64  			PrysmLogging,
    65  			string(sharedAPI.ErrorLogs),
    66  			PrysmTLSCert,
    67  			fmt.Sprintf("%s/cert/tls.crt", shared.PathSecrets(client.HomeDir())),
    68  			PrysmFeeRecipient,
    69  			"0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    70  		}))
    71  
    72  	})
    73  
    74  })