Revert in-memory unit tests for sqlite (#2630)
* revert in-memory unit tests for sqlite * fix unit test * fix comments * fix unit tests
This commit is contained in:
parent
70ab1afecd
commit
71cb654d71
2 changed files with 10 additions and 2 deletions
|
@ -27,7 +27,9 @@ func New(store permissions.Store, logger *mlog.Logger) *Service {
|
|||
}
|
||||
|
||||
func (s *Service) HasPermissionToTeam(userID, teamID string, permission *mmModel.Permission) bool {
|
||||
// Locally there is no team, so return true
|
||||
if userID == "" || teamID == "" || permission == nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package sqlstore
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
|
@ -33,7 +34,12 @@ func PrepareNewTestDatabase() (dbType string, connectionString string, err error
|
|||
var rootUser string
|
||||
|
||||
if dbType == model.SqliteDBType {
|
||||
connectionString = "file::memory:?cache=shared&_busy_timeout=5000"
|
||||
file, err := ioutil.TempFile("", "fbtest_*.db")
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
connectionString = file.Name() + "?_busy_timeout=5000"
|
||||
_ = file.Close()
|
||||
} else if port := strings.TrimSpace(os.Getenv("FB_STORE_TEST_DOCKER_PORT")); port != "" {
|
||||
// docker unit tests take priority over any DSN env vars
|
||||
var template string
|
||||
|
|
Loading…
Reference in a new issue