github.com/kotalco/kotal@v0.3.0/clients/chainlink/chainlink_client_test.go (about)

     1  package chainlink
     2  
     3  import (
     4  	"fmt"
     5  
     6  	chainlinkv1alpha1 "github.com/kotalco/kotal/apis/chainlink/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("Chainlink Client", func() {
    14  	node := &chainlinkv1alpha1.Node{
    15  		Spec: chainlinkv1alpha1.NodeSpec{
    16  			EthereumChainId:    1,
    17  			EthereumWSEndpoint: "ws://my-eth-node:8546",
    18  			EthereumHTTPEndpoints: []string{
    19  				"http://my-eth-node:8545",
    20  				"http://my-eth-node2:8545",
    21  				"http://my-eth-node3:8545",
    22  			},
    23  			LinkContractAddress: "0x01BE23585060835E02B77ef475b0Cc51aA1e0709",
    24  			DatabaseURL:         "postgresql://postgres:secret@postgres:5432/postgres",
    25  			CertSecretName:      "my-certificate",
    26  			TLSPort:             9999,
    27  			P2PPort:             4444,
    28  			APIPort:             7777,
    29  			Logging:             sharedAPI.PanicLogs,
    30  			CORSDomains:         []string{"*"},
    31  			SecureCookies:       true,
    32  		},
    33  	}
    34  
    35  	client := NewClient(node)
    36  
    37  	It("Should get correct command", func() {
    38  		Expect(client.Command()).To(ConsistOf("chainlink"))
    39  	})
    40  
    41  	It("Should get correct environment variables", func() {
    42  		Expect(client.Env()).To(BeNil())
    43  	})
    44  
    45  	It("Should get correct home dir", func() {
    46  		Expect(client.HomeDir()).To(Equal(ChainlinkHomeDir))
    47  	})
    48  
    49  	It("Should get correct args", func() {
    50  		Expect(client.Args()).To(ContainElements(
    51  			"local",
    52  			"node",
    53  			ChainlinkAPI,
    54  			fmt.Sprintf("%s/.api", shared.PathData(client.HomeDir())),
    55  		))
    56  	})
    57  
    58  })