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

     1  package ethereum2
     2  
     3  import (
     4  	"fmt"
     5  
     6  	ethereum2v1alpha1 "github.com/kotalco/kotal/apis/ethereum2/v1alpha1"
     7  	"github.com/kotalco/kotal/controllers/shared"
     8  	. "github.com/onsi/ginkgo/v2"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("Teku Ethereum 2.0 validator client arguments", func() {
    13  
    14  	validator := &ethereum2v1alpha1.Validator{
    15  		Spec: ethereum2v1alpha1.ValidatorSpec{
    16  			Client:          ethereum2v1alpha1.TekuClient,
    17  			Network:         "mainnet",
    18  			BeaconEndpoints: []string{"http://localhost:9988"},
    19  			Graffiti:        "Validated by Kotal",
    20  			FeeRecipient:    "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    21  			Keystores: []ethereum2v1alpha1.Keystore{
    22  				{
    23  					SecretName: "my-validator",
    24  				},
    25  			},
    26  		},
    27  	}
    28  
    29  	validator.Default()
    30  	client, _ := NewClient(validator)
    31  
    32  	It("Should get correct command", func() {
    33  		Expect(client.Command()).To(BeNil())
    34  	})
    35  
    36  	It("Should get correct env", func() {
    37  		Expect(client.Env()).To(BeNil())
    38  	})
    39  
    40  	It("Should get correct home dir", func() {
    41  		Expect(client.HomeDir()).To(Equal(TekuHomeDir))
    42  	})
    43  
    44  	It("Should generate correct client arguments", func() {
    45  		args := client.Args()
    46  
    47  		Expect(args).To(ContainElements([]string{
    48  			"vc",
    49  			TekuDataPath,
    50  			shared.PathData(client.HomeDir()),
    51  			TekuNetwork,
    52  			"auto",
    53  			TekuBeaconNodeEndpoint,
    54  			"http://localhost:9988",
    55  			TekuGraffiti,
    56  			"Validated by Kotal",
    57  			TekuValidatorKeys,
    58  			fmt.Sprintf(
    59  				"%s/validator-keys/my-validator/keystore-0.json:%s/validator-keys/my-validator/password.txt",
    60  				shared.PathSecrets(client.HomeDir()),
    61  				shared.PathSecrets(client.HomeDir()),
    62  			),
    63  			TekuFeeRecipient,
    64  			"0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    65  		}))
    66  
    67  	})
    68  
    69  })