github.com/kotalco/kotal@v0.3.0/clients/filecoin/lotus_client_test.go (about)

     1  package filecoin
     2  
     3  import (
     4  	filecoinv1alpha1 "github.com/kotalco/kotal/apis/filecoin/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  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    10  )
    11  
    12  var _ = Describe("Lotus Filecoin Client", func() {
    13  	node := filecoinv1alpha1.Node{
    14  		ObjectMeta: metav1.ObjectMeta{
    15  			Name:      "calibration-node",
    16  			Namespace: "filecoin",
    17  		},
    18  		Spec: filecoinv1alpha1.NodeSpec{
    19  			Network: filecoinv1alpha1.CalibrationNetwork,
    20  		},
    21  	}
    22  
    23  	client := NewClient(&node)
    24  
    25  	It("Should get correct args", func() {
    26  		Expect(client.Args()).To(BeNil())
    27  	})
    28  
    29  	It("Should get correct env", func() {
    30  		Expect(client.Env()).To(ContainElements(
    31  			corev1.EnvVar{
    32  				Name:  EnvLotusPath,
    33  				Value: shared.PathData(client.HomeDir()),
    34  			},
    35  			corev1.EnvVar{
    36  				Name:  EnvLogLevel,
    37  				Value: string(node.Spec.Logging),
    38  			},
    39  		))
    40  	})
    41  
    42  	It("Should get correct command", func() {
    43  		Expect(client.Command()).To(ContainElements(
    44  			"lotus",
    45  			"daemon",
    46  		))
    47  	})
    48  
    49  	It("Should get image home directory", func() {
    50  		Expect(client.HomeDir()).To(Equal(LotusHomeDir))
    51  	})
    52  })