Fixed the broken tests caused by Brian's panic fix

This commit is contained in:
Zach Musgrave
2019-03-20 13:56:02 -07:00
parent 1c2ec621de
commit ff183dc98e
2 changed files with 3 additions and 7 deletions

View File

@@ -45,7 +45,7 @@ type DoltDB struct {
// LoadDoltDB will acquire a reference to the underlying noms db. If the Location is InMemDoltDB then a reference
// to a newly created in memory database will be used. If the location is LocalDirDoltDB, the directory must exist or
// this function panics.
// this returns nil.
func LoadDoltDB(loc Location) *DoltDB {
if loc == LocalDirDoltDB {
exists, isDir := filesys.LocalFS.Exists(DoltDataDir)

View File

@@ -65,9 +65,7 @@ func TestLoadNonExistentLocalFSRepo(t *testing.T) {
panic("Couldn't change the working directory to the test directory.")
}
assert.Panics(t, func() {
LoadDoltDB(LocalDirDoltDB)
}, "Should have panicked when loading a non-existent data dir")
assert.Nil(t, LoadDoltDB(LocalDirDoltDB), "Should return nil when loading a non-existent data dir")
}
func TestLoadBadLocalFSRepo(t *testing.T) {
@@ -80,9 +78,7 @@ func TestLoadBadLocalFSRepo(t *testing.T) {
contents := []byte("not a directory")
ioutil.WriteFile(filepath.Join(testDir, DoltDataDir), contents, 0644)
assert.Panics(t, func() {
LoadDoltDB(LocalDirDoltDB)
}, "Should have panicked when loading a non-directory data dir file")
assert.Nil(t, LoadDoltDB(LocalDirDoltDB), "Should return nil when loading a non-directory data dir file")
}
func TestLDNoms(t *testing.T) {