From 3bc77a6b47306c38ecdf00f80f66d164da17de7f Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Fri, 21 Sep 2018 11:54:32 +0300 Subject: [PATCH] Test the error reporing on broken migration reversal --- executor_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/executor_test.go b/executor_test.go index a4a4ba8..698cbd3 100644 --- a/executor_test.go +++ b/executor_test.go @@ -58,3 +58,17 @@ func TestSQLExecutor_Down(t *testing.T) { assert.NotNil(t, err) }) } + +func TestSQLExecutor_Down_Broken(t *testing.T) { + td := filepath.Join(dbSrc, "20180920181906_migration_with_an_error") + + exe := NewSQLExecutor(db) + + migration, err := MigrationFromBytes(td, ioutil.ReadFile) + assert.Nil(t, err) + + cleanState(func() { + err := exe.Down(migration, new(testingStore)) + assert.Error(t, err) + }) +}