mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
Peer RPCs for bucket notifications (#2877)
* Implements a Peer RPC router that sends info to all Minio servers in the cluster. * Bucket notifications are propagated to all nodes via this RPC router. * Bucket listener configuration is persisted to separate object layer file (`listener.json`) and peer RPCs are used to communicate changes throughout the cluster. * When events are generated, RPC calls to send them to other servers where bucket listeners may be connected is implemented. * Some bucket notification tests are now disabled as they cannot work in the new design. * Minor fix in `funcFromPC` to use `path.Join`
This commit is contained in:
committed by
Harshavardhana
parent
a5921b5743
commit
6199aa0707
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -174,3 +175,65 @@ func TestMaxPartID(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests fetch local address.
|
||||
func TestLocalAddress(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
return
|
||||
}
|
||||
// need to set this to avoid stale values from other tests.
|
||||
globalMinioPort = 9000
|
||||
testCases := []struct {
|
||||
srvCmdConfig serverCmdConfig
|
||||
localAddr string
|
||||
}{
|
||||
// Test 1 - local address is found.
|
||||
{
|
||||
srvCmdConfig: serverCmdConfig{
|
||||
isDistXL: true,
|
||||
disks: []string{
|
||||
"localhost:/mnt/disk1",
|
||||
"1.1.1.2:/mnt/disk2",
|
||||
"1.1.2.1:/mnt/disk3",
|
||||
"1.1.2.2:/mnt/disk4",
|
||||
},
|
||||
},
|
||||
localAddr: fmt.Sprintf("localhost:%d", globalMinioPort),
|
||||
},
|
||||
// Test 2 - local address is everything.
|
||||
{
|
||||
srvCmdConfig: serverCmdConfig{
|
||||
isDistXL: false,
|
||||
disks: []string{
|
||||
"/mnt/disk1",
|
||||
"/mnt/disk2",
|
||||
"/mnt/disk3",
|
||||
"/mnt/disk4",
|
||||
},
|
||||
},
|
||||
localAddr: fmt.Sprintf(":%d", globalMinioPort),
|
||||
},
|
||||
// Test 3 - local address is not found.
|
||||
{
|
||||
srvCmdConfig: serverCmdConfig{
|
||||
isDistXL: true,
|
||||
disks: []string{
|
||||
"1.1.1.1:/mnt/disk1",
|
||||
"1.1.1.2:/mnt/disk2",
|
||||
"1.1.2.1:/mnt/disk3",
|
||||
"1.1.2.2:/mnt/disk4",
|
||||
},
|
||||
},
|
||||
localAddr: "",
|
||||
},
|
||||
}
|
||||
|
||||
// Validates fetching local address.
|
||||
for i, testCase := range testCases {
|
||||
localAddr := getLocalAddress(testCase.srvCmdConfig)
|
||||
if localAddr != testCase.localAddr {
|
||||
t.Fatalf("Test %d: Expected %s, got %s", i+1, testCase.localAddr, localAddr)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user