github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/process_tracker/process_tracker_suite_test.go (about)

     1  package process_tracker_test
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/gomega"
     6  
     7  	"encoding/json"
     8  	"testing"
     9  
    10  	"github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var iodaemonBin string
    14  var testPrintBin string
    15  
    16  func TestProcess_tracker(t *testing.T) {
    17  	var beforeSuite struct {
    18  		IodaemonPath        string
    19  		TestPrintSignalPath string
    20  	}
    21  
    22  	SynchronizedBeforeSuite(func() []byte {
    23  		var err error
    24  		beforeSuite.IodaemonPath, err = gexec.Build("github.com/cloudfoundry-incubator/garden-linux/iodaemon/cmd/iodaemon")
    25  		Expect(err).ToNot(HaveOccurred())
    26  
    27  		beforeSuite.TestPrintSignalPath, err = gexec.Build("github.com/cloudfoundry-incubator/garden-linux/iodaemon/test_print_signals")
    28  		Expect(err).ToNot(HaveOccurred())
    29  
    30  		b, err := json.Marshal(beforeSuite)
    31  		Expect(err).ToNot(HaveOccurred())
    32  
    33  		return b
    34  	}, func(paths []byte) {
    35  		err := json.Unmarshal(paths, &beforeSuite)
    36  		Expect(err).ToNot(HaveOccurred())
    37  
    38  		iodaemonBin = beforeSuite.IodaemonPath
    39  		Expect(iodaemonBin).NotTo(BeEmpty())
    40  
    41  		testPrintBin = beforeSuite.TestPrintSignalPath
    42  		Expect(testPrintBin).NotTo(BeEmpty())
    43  	})
    44  
    45  	SynchronizedAfterSuite(func() {
    46  		//noop
    47  	}, func() {
    48  		gexec.CleanupBuildArtifacts()
    49  	})
    50  
    51  	RegisterFailHandler(Fail)
    52  	RunSpecs(t, "Process Tracker Suite")
    53  }