standardize env var naming (#3031)

This commit is contained in:
Doug Lauder 2022-05-05 15:49:34 -04:00 committed by GitHub
parent 31a3ba8e6a
commit 554a790e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -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

View file

@ -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/...

View file

@ -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

View file

@ -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
}

View file

@ -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
}