mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
Adding test coverage for server-mux.go by creating TestListenAndServeTLS(). (#2493)
Editing config.go to add lock on customConfigPath to avoid race condition when setGlobalConfigPath() and getConfigPath() are called concurrently.
This commit is contained in:
committed by
Harshavardhana
parent
a8052889fe
commit
f2fd8b0265
@@ -19,20 +19,27 @@ package cmd
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/minio/go-homedir"
|
||||
)
|
||||
|
||||
// configPath for custom config path only for testing purposes
|
||||
var customConfigPath string
|
||||
var configMu sync.Mutex
|
||||
|
||||
// Sets a new config path.
|
||||
func setGlobalConfigPath(configPath string) {
|
||||
configMu.Lock()
|
||||
defer configMu.Unlock()
|
||||
customConfigPath = configPath
|
||||
}
|
||||
|
||||
// getConfigPath get server config path
|
||||
func getConfigPath() (string, error) {
|
||||
configMu.Lock()
|
||||
defer configMu.Unlock()
|
||||
|
||||
if customConfigPath != "" {
|
||||
return customConfigPath, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user