github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/exec/exec_test.go (about)

     1  //go:build debugspy
     2  // +build debugspy
     3  
     4  // ^ this test requires debugspy to be enabled so to run this test make sure to include -tags debugspy
     5  
     6  package exec
     7  
     8  import (
     9  	. "github.com/onsi/ginkgo/v2"
    10  	. "github.com/onsi/gomega"
    11  
    12  	"github.com/pyroscope-io/pyroscope/pkg/config"
    13  	"github.com/pyroscope-io/pyroscope/pkg/testing"
    14  )
    15  
    16  var _ = Describe("Cli", func() {
    17  	disableMacOSChecks = true
    18  	disableLinuxChecks = true
    19  
    20  	testing.WithConfig(func(cfg **config.Config) {
    21  		Describe("Exec", func() {
    22  			Context("no arguments", func() {
    23  				It("returns error", func() {
    24  					_, err := NewExec(&(*cfg).Exec, []string{})
    25  					Expect(err).To(MatchError("no arguments passed"))
    26  				})
    27  			})
    28  			Context("simple case", func() {
    29  				It("returns nil", func() {
    30  					(*cfg).Exec.SpyName = "debugspy"
    31  					_, err := NewExec(&(*cfg).Exec, []string{"ls"})
    32  					Expect(err).ToNot(HaveOccurred())
    33  				})
    34  			})
    35  		})
    36  	})
    37  })