github.com/kotalco/kotal@v0.3.0/clients/ipfs/go_ipfs_cluster_client_test.go (about) 1 package ipfs 2 3 import ( 4 ipfsv1alpha1 "github.com/kotalco/kotal/apis/ipfs/v1alpha1" 5 "github.com/kotalco/kotal/controllers/shared" 6 . "github.com/onsi/ginkgo/v2" 7 . "github.com/onsi/gomega" 8 corev1 "k8s.io/api/core/v1" 9 ) 10 11 var _ = Describe("Go IPFS Cluster Client", func() { 12 peer := &ipfsv1alpha1.ClusterPeer{ 13 Spec: ipfsv1alpha1.ClusterPeerSpec{ 14 Consensus: ipfsv1alpha1.Raft, 15 PeerEndpoint: "/dns4/bare-peer/tcp/5001", 16 BootstrapPeers: []string{ 17 "/ip4/95.111.253.236/tcp/4001/p2p/Qmd3FERyCvxvkC8su1DYhjybRaLueHveKysUVPxWAqR4U7", 18 }, 19 ClusterSecretName: "cluster-secret", 20 }, 21 } 22 23 client, _ := NewClient(peer) 24 25 It("Should get correct env", func() { 26 Expect(client.Env()).To(Equal( 27 []corev1.EnvVar{ 28 { 29 Name: EnvIPFSClusterPath, 30 Value: shared.PathData(client.HomeDir()), 31 }, 32 { 33 Name: EnvIPFSClusterPeerName, 34 Value: peer.Name, 35 }, 36 { 37 Name: EnvIPFSLogging, 38 Value: string(peer.Spec.Logging), 39 }, 40 }, 41 )) 42 }) 43 44 It("Should get correct command", func() { 45 Expect(client.Command()).To(ConsistOf("ipfs-cluster-service")) 46 }) 47 48 It("Should get correct home dir", func() { 49 Expect(client.HomeDir()).To(Equal(GoIPFSClusterHomeDir)) 50 }) 51 52 It("Should get correct args", func() { 53 Expect(client.Args()).To(ContainElements( 54 GoIPFSDaemonArg, 55 GoIPFSClusterBootstrapArg, 56 "/ip4/95.111.253.236/tcp/4001/p2p/Qmd3FERyCvxvkC8su1DYhjybRaLueHveKysUVPxWAqR4U7", 57 )) 58 }) 59 60 })