From ff183dc98e6ead4c230f624863165cd1b2cb3e02 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Wed, 20 Mar 2019 13:56:02 -0700 Subject: [PATCH] Fixed the broken tests caused by Brian's panic fix --- go/libraries/doltcore/doltdb/doltdb.go | 2 +- go/libraries/doltcore/doltdb/doltdb_test.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/go/libraries/doltcore/doltdb/doltdb.go b/go/libraries/doltcore/doltdb/doltdb.go index 27fec24dfb..e584dd8be7 100644 --- a/go/libraries/doltcore/doltdb/doltdb.go +++ b/go/libraries/doltcore/doltdb/doltdb.go @@ -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) diff --git a/go/libraries/doltcore/doltdb/doltdb_test.go b/go/libraries/doltcore/doltdb/doltdb_test.go index edce2f6072..0cc12bb4fc 100644 --- a/go/libraries/doltcore/doltdb/doltdb_test.go +++ b/go/libraries/doltcore/doltdb/doltdb_test.go @@ -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) {