mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
standardize env var naming (#3031)
This commit is contained in:
parent
31a3ba8e6a
commit
554a790e57
16
Makefile
16
Makefile
@ -115,20 +115,20 @@ watch-server-test: modd-precheck ## Run server tests watching for changes
|
||||
|
||||
server-test: server-test-sqlite server-test-mysql server-test-postgres ## Run server tests
|
||||
|
||||
server-test-sqlite: export FB_UNIT_TESTING=1
|
||||
server-test-sqlite: export FOCALBOARD_UNIT_TESTING=1
|
||||
|
||||
server-test-sqlite: templates-archive ## Run server tests using sqlite
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-sqlite-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd server; go tool cover -func server-sqlite-profile.coverage
|
||||
|
||||
server-test-mini-sqlite: export FB_UNIT_TESTING=1
|
||||
server-test-mini-sqlite: export FOCALBOARD_UNIT_TESTING=1
|
||||
|
||||
server-test-mini-sqlite: templates-archive ## Run server tests using sqlite
|
||||
cd server/integrationtests; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
|
||||
server-test-mysql: export FB_UNIT_TESTING=1
|
||||
server-test-mysql: export FB_STORE_TEST_DB_TYPE=mysql
|
||||
server-test-mysql: export FB_STORE_TEST_DOCKER_PORT=44445
|
||||
server-test-mysql: export FOCALBOARD_UNIT_TESTING=1
|
||||
server-test-mysql: export FOCALBOARD_STORE_TEST_DB_TYPE=mysql
|
||||
server-test-mysql: export FOCALBOARD_STORE_TEST_DOCKER_PORT=44445
|
||||
|
||||
server-test-mysql: templates-archive ## Run server tests using mysql
|
||||
@echo Starting docker container for mysql
|
||||
@ -140,9 +140,9 @@ server-test-mysql: templates-archive ## Run server tests using mysql
|
||||
cd mattermost-plugin/server; go tool cover -func plugin-mysql-profile.coverage
|
||||
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
||||
|
||||
server-test-postgres: export FB_UNIT_TESTING=1
|
||||
server-test-postgres: export FB_STORE_TEST_DB_TYPE=postgres
|
||||
server-test-postgres: export FB_STORE_TEST_DOCKER_PORT=44446
|
||||
server-test-postgres: export FOCALBOARD_UNIT_TESTING=1
|
||||
server-test-postgres: export FOCALBOARD_STORE_TEST_DB_TYPE=postgres
|
||||
server-test-postgres: export FOCALBOARD_STORE_TEST_DOCKER_PORT=44446
|
||||
|
||||
server-test-postgres: templates-archive ## Run server tests using postgres
|
||||
@echo Starting docker container for postgres
|
||||
|
@ -214,7 +214,7 @@ detach: setup-attach
|
||||
|
||||
## Runs any lints and unit tests defined for the server and webapp, if they exist.
|
||||
.PHONY: test
|
||||
test: export FB_UNIT_TESTING=1
|
||||
test: export FOCALBOARD_UNIT_TESTING=1
|
||||
test: webapp/node_modules
|
||||
ifneq ($(HAS_SERVER),)
|
||||
$(GO) test -v $(GO_TEST_FLAGS) ./server/...
|
||||
|
@ -38,7 +38,7 @@ func (s *SQLStore) MarshalJSONB(data interface{}) ([]byte, error) {
|
||||
}
|
||||
|
||||
func PrepareNewTestDatabase() (dbType string, connectionString string, err error) {
|
||||
dbType = strings.TrimSpace(os.Getenv("FB_STORE_TEST_DB_TYPE"))
|
||||
dbType = strings.TrimSpace(os.Getenv("FOCALBOARD_STORE_TEST_DB_TYPE"))
|
||||
if dbType == "" {
|
||||
dbType = model.SqliteDBType
|
||||
}
|
||||
@ -53,7 +53,7 @@ func PrepareNewTestDatabase() (dbType string, connectionString string, err error
|
||||
}
|
||||
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("FOCALBOARD_STORE_TEST_DOCKER_PORT")); port != "" {
|
||||
// docker unit tests take priority over any DSN env vars
|
||||
var template string
|
||||
switch dbType {
|
||||
@ -97,7 +97,7 @@ func PrepareNewTestDatabase() (dbType string, connectionString string, err error
|
||||
connectionString = fmt.Sprintf(template, "mmuser", port, dbName)
|
||||
} else {
|
||||
// mysql or postgres need a DSN (connection string)
|
||||
connectionString = strings.TrimSpace(os.Getenv("FB_STORE_TEST_CONN_STRING"))
|
||||
connectionString = strings.TrimSpace(os.Getenv("FOCALBOARD_STORE_TEST_CONN_STRING"))
|
||||
}
|
||||
|
||||
return dbType, connectionString, nil
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
// IsRunningUnitTests returns true if this instance of FocalBoard is running unit or integration tests.
|
||||
func IsRunningUnitTests() bool {
|
||||
testing := os.Getenv("FB_UNIT_TESTING")
|
||||
testing := os.Getenv("FOCALBOARD_UNIT_TESTING")
|
||||
if testing == "" {
|
||||
return false
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func fileExists(path string) bool {
|
||||
|
||||
// errorOrWarn returns a `warn` level if this server instance is running unit tests, otherwise `error`.
|
||||
func errorOrWarn() mlog.Level {
|
||||
unitTesting := strings.ToLower(strings.TrimSpace(os.Getenv("FB_UNIT_TESTING")))
|
||||
unitTesting := strings.ToLower(strings.TrimSpace(os.Getenv("FOCALBOARD_UNIT_TESTING")))
|
||||
if unitTesting == "1" || unitTesting == "y" || unitTesting == "t" {
|
||||
return mlog.LvlWarn
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user