-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Extractor concurrency. - Database SQL was missing 'INTO' keyword, it was added. - Moved 'init.sql' - Some minor clean-ups for c.complexity reasons
- Loading branch information
1 parent
c162537
commit c05cf63
Showing
12 changed files
with
295 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package database | ||
|
||
import ( | ||
"database/sql" | ||
"log" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
const ( | ||
sqliteInMemoryOption = "file::memory:?cache=shared" | ||
) | ||
|
||
func TestInitDatabase(t *testing.T) { | ||
dbConn, err := ConnectToServer(sqliteInMemoryOption) | ||
assert.NotNil(t, dbConn) | ||
assert.NoError(t, err) | ||
|
||
defer func(db *sql.DB) { | ||
err := db.Close() | ||
if err != nil { | ||
log.Fatalf("TestInitDatabase: Problem occurred while trying to close database -> %v", err) | ||
} | ||
}(dbConn) | ||
|
||
err = ExecuteInitSQL(dbConn, "./init.sql") | ||
assert.NoError(t, err) | ||
|
||
tables := [5]string{"system_config_default", "addon", "run_log", "download_log", "extract_log"} | ||
|
||
for _, table := range tables { | ||
sqliteTableCheck := "SELECT name FROM sqlite_master WHERE type='table' AND name='" + table + "'" | ||
assert.NotNil(t, sqliteTableCheck) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.