mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 02:22:26 -05:00
Test both dbs (#205)
* move scripts, allow testing both dbs with one cmd * tidy + vendor * update test.sh to ignore cache * put test commands directly in drone.yml * change CONTRIBUTING slightly * go ham on the readme
This commit is contained in:
parent
f2e5bedea6
commit
64bd689e55
16 changed files with 337 additions and 196 deletions
|
|
@ -21,6 +21,7 @@ package testrig
|
|||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
|
|
@ -58,6 +59,12 @@ var testModels []interface{} = []interface{}{
|
|||
//
|
||||
// If the environment variable GTS_DB_ADDRESS is set, it will take that
|
||||
// value as the database address instead.
|
||||
//
|
||||
// If the environment variable GTS_DB_TYPE is set, it will take that
|
||||
// value as the database type instead.
|
||||
//
|
||||
// If the environment variable GTS_DB_PORT is set, it will take that
|
||||
// value as the port instead.
|
||||
func NewTestDB() db.DB {
|
||||
config := NewTestConfig()
|
||||
alternateAddress := os.Getenv("GTS_DB_ADDRESS")
|
||||
|
|
@ -65,6 +72,20 @@ func NewTestDB() db.DB {
|
|||
config.DBConfig.Address = alternateAddress
|
||||
}
|
||||
|
||||
alternateDBType := os.Getenv("GTS_DB_TYPE")
|
||||
if alternateDBType != "" {
|
||||
config.DBConfig.Type = alternateDBType
|
||||
}
|
||||
|
||||
alternateDBPort := os.Getenv("GTS_DB_PORT")
|
||||
if alternateDBPort != "" {
|
||||
port, err := strconv.ParseInt(alternateDBPort, 10, 64)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
config.DBConfig.Port = int(port)
|
||||
}
|
||||
|
||||
testDB, err := bundb.NewBunDBService(context.Background(), config, NewTestLog())
|
||||
if err != nil {
|
||||
logrus.Panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue