diff --git a/tests/testdb.go b/tests/testdb.go index b6797cb..c920c05 100644 --- a/tests/testdb.go +++ b/tests/testdb.go @@ -26,17 +26,17 @@ func Init_testdb(DB_TYPE string, DB_CONNECTION_STRING string) { log.Trace().Msgf("Currect working directory is: %s", cwd) } - _, err = os.Stat(cwd + DB_CONNECTION_STRING) + _, err = os.Stat(cwd + DB_CONNECTION_STRING) if err != nil { - log.Debug().Msg("Found existing test.db file. Attempting to delete") - err = os.Remove(DB_CONNECTION_STRING) - if err != nil { - log.Warn().Err(err).Msg("Failed to delete testing db. Continueing anyways") - } else { - log.Debug().Msg("Deleted test.db file successfully") - } - } else { log.Debug().Msg("No existing test.db file found") + } else { + log.Debug().Msg("Found existing test.db file. Attempting to delete") + err = os.Remove(cwd + DB_CONNECTION_STRING) + if err != nil { + log.Warn().Err(err).Msg("Failed to delete testing db. Continueing anyways") + } else { + log.Debug().Msg("Deleted test.db file successfully") + } } db, err := sqlx.Connect(DB_TYPE, DB_CONNECTION_STRING)