mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-08-29 09:47:29 +00:00
test: fail fast on suite setup/teardown
This commit is contained in:
@@ -78,7 +78,7 @@ func (s *enryBaseTestSuite) SetupSuite() {
|
|||||||
func (s *enryBaseTestSuite) TearDownSuite() {
|
func (s *enryBaseTestSuite) TearDownSuite() {
|
||||||
if s.isCleanupNeeded {
|
if s.isCleanupNeeded {
|
||||||
err := os.RemoveAll(s.tmpLinguistDir)
|
err := os.RemoveAll(s.tmpLinguistDir)
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -125,28 +125,28 @@ func (s *GeneratorTestSuite) maybeCloneLinguist() {
|
|||||||
isLinguistCloned := s.tmpLinguistDir != ""
|
isLinguistCloned := s.tmpLinguistDir != ""
|
||||||
if !isLinguistCloned {
|
if !isLinguistCloned {
|
||||||
s.tmpLinguistDir, err = ioutil.TempDir("", "linguist-")
|
s.tmpLinguistDir, err = ioutil.TempDir("", "linguist-")
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
|
|
||||||
s.T().Logf("Cloning Linguist repo to '%s' as %s was not set\n",
|
s.T().Logf("Cloning Linguist repo to '%s' as %s was not set\n",
|
||||||
s.tmpLinguistDir, linguistClonedEnvVar)
|
s.tmpLinguistDir, linguistClonedEnvVar)
|
||||||
cmd := exec.Command("git", "clone", "--depth", "100", linguistURL, s.tmpLinguistDir)
|
cmd := exec.Command("git", "clone", "--depth", "100", linguistURL, s.tmpLinguistDir)
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
s.isCleanupNeeded = true
|
s.isCleanupNeeded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
|
|
||||||
err = os.Chdir(s.tmpLinguistDir)
|
err = os.Chdir(s.tmpLinguistDir)
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
|
|
||||||
cmd := exec.Command("git", "checkout", commit)
|
cmd := exec.Command("git", "checkout", commit)
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
|
|
||||||
err = os.Chdir(cwd)
|
err = os.Chdir(cwd)
|
||||||
assert.NoError(s.T(), err)
|
require.NoError(s.T(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GeneratorTestSuite) SetupSuite() {
|
func (s *GeneratorTestSuite) SetupSuite() {
|
||||||
|
Reference in New Issue
Block a user