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 {
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package sqlstore
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -33,7 +34,12 @@ func PrepareNewTestDatabase() (dbType string, connectionString string, err error
|
||||||
var rootUser string
|
var rootUser string
|
||||||
|
|
||||||
if dbType == model.SqliteDBType {
|
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 != "" {
|
} else if port := strings.TrimSpace(os.Getenv("FB_STORE_TEST_DOCKER_PORT")); port != "" {
|
||||||
// docker unit tests take priority over any DSN env vars
|
// docker unit tests take priority over any DSN env vars
|
||||||
var template string
|
var template string
|
||||||
|
|
Loading…
Reference in a new issue