github.com/geofffranks/garden-linux@v0.0.0-20160715111146-26c893169cfa/system/system_suite_linux_test.go (about) 1 package system_test 2 3 import ( 4 "encoding/json" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 "github.com/onsi/gomega/gexec" 9 10 "testing" 11 ) 12 13 var ( 14 testCapabilitiesPath string 15 testUserExecerPath string 16 ) 17 18 type CompiledAssets struct { 19 TestCapabilitiesPath string 20 TestUserExecerPath string 21 } 22 23 var _ = SynchronizedBeforeSuite(func() []byte { 24 var err error 25 assets := CompiledAssets{} 26 assets.TestCapabilitiesPath, err = gexec.Build("code.cloudfoundry.org/garden-linux/system/test_capabilities") 27 Expect(err).ToNot(HaveOccurred()) 28 29 assets.TestUserExecerPath, err = gexec.Build("code.cloudfoundry.org/garden-linux/system/test_user_execer") 30 Expect(err).ToNot(HaveOccurred()) 31 32 marshalledAssets, err := json.Marshal(assets) 33 Expect(err).ToNot(HaveOccurred()) 34 return marshalledAssets 35 }, func(marshalledAssets []byte) { 36 assets := CompiledAssets{} 37 err := json.Unmarshal(marshalledAssets, &assets) 38 Expect(err).ToNot(HaveOccurred()) 39 testCapabilitiesPath = assets.TestCapabilitiesPath 40 testUserExecerPath = assets.TestUserExecerPath 41 }) 42 43 var _ = SynchronizedAfterSuite(func() { 44 //noop 45 }, func() { 46 gexec.CleanupBuildArtifacts() 47 }) 48 49 func TestSystem(t *testing.T) { 50 RegisterFailHandler(Fail) 51 RunSpecs(t, "System Suite") 52 }