github.com/kotalco/kotal@v0.3.0/clients/bitcoin/bitcoin_core_client_test.go (about) 1 package bitcoin 2 3 import ( 4 bitcoinv1alpha1 "github.com/kotalco/kotal/apis/bitcoin/v1alpha1" 5 . "github.com/onsi/ginkgo/v2" 6 . "github.com/onsi/gomega" 7 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 8 ) 9 10 var _ = Describe("Bitcoin core client", func() { 11 12 listen := false 13 var maxConnections uint = 123 14 node := &bitcoinv1alpha1.Node{ 15 ObjectMeta: metav1.ObjectMeta{ 16 Name: "bitcoin-node", 17 Namespace: "default", 18 }, 19 Spec: bitcoinv1alpha1.NodeSpec{ 20 Network: "mainnet", 21 Listen: &listen, 22 MaxConnections: &maxConnections, 23 RPC: true, 24 P2PPort: 8888, 25 RPCPort: 7777, 26 Wallet: false, 27 TransactionIndex: true, 28 CoinStatsIndex: true, 29 BlocksOnly: true, 30 Pruning: true, 31 ReIndex: true, 32 DBCacheSize: 2048, 33 }, 34 } 35 36 node.Default() 37 // nil is passed because there's no reconciler client 38 // TODO: create test for rpcUsers where client is not nil 39 client := NewClient(node, nil) 40 41 It("Should get correct command", func() { 42 Expect(client.Command()).To(Equal([]string{ 43 "bitcoind", 44 })) 45 }) 46 47 It("Should get correct home directory", func() { 48 Expect(client.HomeDir()).To(Equal(BitcoinCoreHomeDir)) 49 }) 50 51 It("Should generate correct client arguments", func() { 52 Expect(client.Args()).To(ContainElements([]string{ 53 "-chain=main", 54 "-listen=0", 55 "-datadir=/data/kotal-data", 56 "-server=1", 57 "-bind=0.0.0.0:8888", 58 "-rpcport=7777", 59 "-rpcbind=0.0.0.0", 60 "-rpcallowip=0.0.0.0/0", 61 "-disablewallet", 62 "-txindex=1", 63 "-blocksonly=1", 64 "-reindex=1", 65 "-coinstatsindex=1", 66 "-prune=1", 67 "-dbcache=2048", 68 "-maxconnections=123", 69 })) 70 }) 71 72 })