mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
Test Function to reset globals. (#3538)
- Adding reset functions for important global variables. - Using them in tests.
This commit is contained in:
committed by
Harshavardhana
parent
464f9d34d6
commit
2f4a7483ea
@@ -456,6 +456,23 @@ func resetGlobalConfig() {
|
||||
serverConfigMu.Unlock()
|
||||
}
|
||||
|
||||
// reset global NSLock.
|
||||
func resetGlobalNSLock() {
|
||||
if globalNSMutex != nil {
|
||||
globalNSMutex = nil
|
||||
}
|
||||
}
|
||||
|
||||
// reset global event notifier.
|
||||
func resetGlobalEventNotifier() {
|
||||
globalEventNotifier = nil
|
||||
}
|
||||
|
||||
// reset Global event notifier.
|
||||
func resetGlobalEventnotify() {
|
||||
globalEventNotifier = nil
|
||||
}
|
||||
|
||||
// Resets all the globals used modified in tests.
|
||||
// Resetting ensures that the changes made to globals by one test doesn't affect others.
|
||||
func resetTestGlobals() {
|
||||
@@ -465,6 +482,10 @@ func resetTestGlobals() {
|
||||
resetGlobalConfigPath()
|
||||
// Reset Global server config.
|
||||
resetGlobalConfig()
|
||||
// Reset global NSLock.
|
||||
resetGlobalNSLock()
|
||||
// Reset global event notifier.
|
||||
resetGlobalEventnotify()
|
||||
}
|
||||
|
||||
// Configure the server for the test run.
|
||||
@@ -1876,6 +1897,11 @@ func ExecObjectLayerAPINilTest(t TestErrHandler, bucketName, objectName, instanc
|
||||
// ExecObjectLayerAPITest - executes object layer API tests.
|
||||
// Creates single node and XL ObjectLayer instance, registers the specified API end points and runs test for both the layers.
|
||||
func ExecObjectLayerAPITest(t *testing.T, objAPITest objAPITestType, endpoints []string) {
|
||||
// reset globals.
|
||||
// this is to make sure that the tests are not affected by modified value.
|
||||
resetTestGlobals()
|
||||
// initialize NSLock.
|
||||
initNSLock(false)
|
||||
// initialize the server and obtain the credentials and root.
|
||||
// credentials are necessary to sign the HTTP request.
|
||||
rootPath, err := newTestConfig("us-east-1")
|
||||
|
||||
Reference in New Issue
Block a user