mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
Use Peer RPC to propagate bucket policy changes (#2891)
This commit is contained in:
committed by
Harshavardhana
parent
55f6828750
commit
0aabc1d8d9
@@ -29,6 +29,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@@ -182,22 +183,39 @@ func StartTestServer(t TestErrHandler, instanceType string) TestServer {
|
||||
t.Fatalf("Failed obtaining Temp Backend: <ERROR> %s", err)
|
||||
}
|
||||
|
||||
// Run TestServer.
|
||||
srvCmdCfg := serverCmdConfig{
|
||||
disks: disks,
|
||||
storageDisks: storageDisks,
|
||||
}
|
||||
httpHandler, err := configureServerHandler(
|
||||
serverCmdConfig{
|
||||
disks: disks,
|
||||
storageDisks: storageDisks,
|
||||
},
|
||||
srvCmdCfg,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to configure one of the RPC services <ERROR> %s", err)
|
||||
}
|
||||
|
||||
// Run TestServer.
|
||||
testServer.Server = httptest.NewServer(httpHandler)
|
||||
|
||||
srvCmdCfg.serverAddr = testServer.Server.Listener.Addr().String()
|
||||
|
||||
testServer.Obj = objLayer
|
||||
globalObjLayerMutex.Lock()
|
||||
globalObjectAPI = objLayer
|
||||
globalObjLayerMutex.Unlock()
|
||||
|
||||
// initialize peer rpc
|
||||
_, portStr, err := net.SplitHostPort(srvCmdCfg.serverAddr)
|
||||
if err != nil {
|
||||
t.Fatal("Early setup error:", err)
|
||||
}
|
||||
globalMinioPort, err = strconv.Atoi(portStr)
|
||||
if err != nil {
|
||||
t.Fatal("Early setup error:", err)
|
||||
}
|
||||
globalMinioAddr = getLocalAddress(srvCmdCfg)
|
||||
initGlobalS3Peers(disks)
|
||||
|
||||
return testServer
|
||||
}
|
||||
|
||||
@@ -1617,7 +1635,7 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, testName, bucketName, objectName,
|
||||
Statements: []policyStatement{policyFunc(bucketName, "")},
|
||||
}
|
||||
|
||||
globalBucketPolicies.SetBucketPolicy(bucketName, &policy)
|
||||
globalBucketPolicies.SetBucketPolicy(bucketName, policyChange{false, &policy})
|
||||
// now call the handler again with the unsigned/anonymous request, it should be accepted.
|
||||
rec = httptest.NewRecorder()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user