Skip to content

Commit

Permalink
Added integration test for compilation
Browse files Browse the repository at this point in the history
Signed-off-by: Phan Le <ple@pivotallabs.com>
  • Loading branch information
maximilien authored and Phan Le committed Aug 14, 2014
1 parent 06d5e35 commit b766df0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 5 additions & 5 deletions integration/integration_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ func TestIntegration(t *testing.T) {
})

var (
boshMicroPath string
oldHome string
homePath string
oldHome string
)
BeforeEach(func() {
oldHome = os.Getenv("HOME")

var err error
boshMicroPath, err = ioutil.TempDir("", "micro-bosh-cli-integration")
homePath, err = ioutil.TempDir("", "micro-bosh-cli-integration")
Expect(err).NotTo(HaveOccurred())
os.Setenv("HOME", boshMicroPath)
os.Setenv("HOME", homePath)
})

AfterEach(func() {
os.Setenv("HOME", oldHome)
os.RemoveAll(boshMicroPath)
os.RemoveAll(homePath)
})

AfterSuite(func() {
Expand Down
9 changes: 9 additions & 0 deletions integration/micro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import (
"io/ioutil"
"os"
"path"
"path/filepath"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

boshlog "github.com/cloudfoundry/bosh-agent/logger"
boshsys "github.com/cloudfoundry/bosh-agent/system"

bmtestutils "github.com/cloudfoundry/bosh-micro-cli/testutils"
)

Expand All @@ -17,13 +21,16 @@ var _ = Describe("bosh-micro", func() {
deploymentManifestDir string
deploymentManifestFilePath string
cpiReleasePath string
fileSystem boshsys.FileSystem
)

Context("when a CPI release exists", func() {
BeforeEach(func() {
var err error
cpiReleasePath = testCpiFilePath
Expect(err).NotTo(HaveOccurred())
logger := boshlog.NewLogger(boshlog.LevelNone)
fileSystem = boshsys.NewOsFileSystem(logger)
})

Context("when a manifest exists", func() {
Expand Down Expand Up @@ -62,6 +69,8 @@ var _ = Describe("bosh-micro", func() {
session, err = bmtestutils.RunBoshMicro("deploy", cpiReleasePath)
Expect(err).NotTo(HaveOccurred())
Expect(session.ExitCode()).To(Equal(0))
boshMicroHiddenPath := filepath.Join(os.Getenv("HOME"), ".bosh_micro")
Expect(fileSystem.FileExists(boshMicroHiddenPath)).To(BeTrue())
})

Context("when the CPI release is invalid", func() {
Expand Down

0 comments on commit b766df0

Please sign in to comment.