mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
Revert "Revert "tests: Add context cancelation (#15374)""
This reverts commit 564a0afae1.
This commit is contained in:
@@ -184,7 +184,7 @@ func calculateStreamContentLength(dataLen, chunkSize int64) int64 {
|
||||
return streamLen
|
||||
}
|
||||
|
||||
func prepareFS() (ObjectLayer, string, error) {
|
||||
func prepareFS(ctx context.Context) (ObjectLayer, string, error) {
|
||||
nDisks := 1
|
||||
fsDirs, err := getRandomDisks(nDisks)
|
||||
if err != nil {
|
||||
@@ -195,9 +195,9 @@ func prepareFS() (ObjectLayer, string, error) {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
|
||||
globalIAMSys.Init(context.Background(), obj, globalEtcdClient, 2*time.Second)
|
||||
globalIAMSys.Init(ctx, obj, globalEtcdClient, 2*time.Second)
|
||||
return obj, fsDirs[0], nil
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ func initFSObjects(disk string, t *testing.T) (obj ObjectLayer) {
|
||||
|
||||
newTestConfig(globalMinioDefaultRegion, obj)
|
||||
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(GlobalContext)
|
||||
return obj
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ func initTestServerWithBackend(ctx context.Context, t TestErrHandler, testServer
|
||||
globalMinioPort = port
|
||||
globalMinioAddr = getEndpointsLocalAddr(testServer.Disks)
|
||||
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
|
||||
globalEtcdClient = nil
|
||||
|
||||
@@ -446,7 +446,7 @@ func resetGlobalIsErasure() {
|
||||
func resetGlobalHealState() {
|
||||
// Init global heal state
|
||||
if globalAllHealState == nil {
|
||||
globalAllHealState = newHealState(false)
|
||||
globalAllHealState = newHealState(GlobalContext, false)
|
||||
} else {
|
||||
globalAllHealState.Lock()
|
||||
for _, v := range globalAllHealState.healSeqMap {
|
||||
@@ -459,7 +459,7 @@ func resetGlobalHealState() {
|
||||
|
||||
// Init background heal state
|
||||
if globalBackgroundHealState == nil {
|
||||
globalBackgroundHealState = newHealState(false)
|
||||
globalBackgroundHealState = newHealState(GlobalContext, false)
|
||||
} else {
|
||||
globalBackgroundHealState.Lock()
|
||||
for _, v := range globalBackgroundHealState.healSeqMap {
|
||||
@@ -1492,7 +1492,7 @@ func getRandomDisks(N int) ([]string, error) {
|
||||
|
||||
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
||||
func newTestObjectLayer(ctx context.Context, endpointServerPools EndpointServerPools) (newObject ObjectLayer, err error) {
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
|
||||
return newErasureServerPools(ctx, endpointServerPools)
|
||||
}
|
||||
@@ -1536,7 +1536,7 @@ func removeDiskN(disks []string, n int) {
|
||||
// initialies the root and returns its path.
|
||||
// return credentials.
|
||||
func initAPIHandlerTest(ctx context.Context, obj ObjectLayer, endpoints []string) (string, http.Handler, error) {
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
|
||||
initConfigSubsystem(ctx, obj)
|
||||
|
||||
@@ -1574,7 +1574,7 @@ func prepareTestBackend(ctx context.Context, instanceType string) (ObjectLayer,
|
||||
return prepareErasure16(ctx)
|
||||
default:
|
||||
// return FS backend by default.
|
||||
obj, disk, err := prepareFS()
|
||||
obj, disk, err := prepareFS(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -1746,7 +1746,7 @@ func ExecObjectLayerAPITest(t *testing.T, objAPITest objAPITestType, endpoints [
|
||||
// this is to make sure that the tests are not affected by modified value.
|
||||
resetTestGlobals()
|
||||
|
||||
objLayer, fsDir, err := prepareFS()
|
||||
objLayer, fsDir, err := prepareFS(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Initialization of object layer failed for single node setup: %s", err)
|
||||
}
|
||||
@@ -1825,13 +1825,12 @@ func ExecObjectLayerTest(t TestErrHandler, objTest objTestType) {
|
||||
localMetacacheMgr.deleteAll()
|
||||
}
|
||||
|
||||
objLayer, fsDir, err := prepareFS()
|
||||
objLayer, fsDir, err := prepareFS(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Initialization of object layer failed for single node setup: %s", err)
|
||||
}
|
||||
setObjectLayer(objLayer)
|
||||
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
|
||||
// initialize the server and obtain the credentials and root.
|
||||
// credentials are necessary to sign the HTTP request.
|
||||
@@ -1857,7 +1856,7 @@ func ExecObjectLayerTest(t TestErrHandler, objTest objTestType) {
|
||||
localMetacacheMgr.deleteAll()
|
||||
}
|
||||
|
||||
initAllSubsystems()
|
||||
initAllSubsystems(ctx)
|
||||
objLayer, fsDirs, err := prepareErasureSets32(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Initialization of object layer failed for Erasure setup: %s", err)
|
||||
|
||||
Reference in New Issue
Block a user