mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update IDs with node1 and node2 from rpcclient_it_test.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
df405ff3e6
commit
b6df4a7c01
@@ -4,6 +4,10 @@
|
||||
// Used for multiple RAL configuration tests
|
||||
// Starts rater, scheduler
|
||||
|
||||
"general": {
|
||||
"node_id":"node1",
|
||||
},
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012", // RPC JSON listening address
|
||||
"rpc_gob": ":2013", // RPC GOB listening address
|
||||
@@ -18,4 +22,4 @@
|
||||
"enabled": true, // enable Rater service: <true|false>
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// Used for multiple RAL configuration tests
|
||||
// Starts RAL
|
||||
|
||||
"general": {
|
||||
"node_id":"node2",
|
||||
},
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":12012",
|
||||
"rpc_gob": ":12013",
|
||||
@@ -26,4 +30,4 @@
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,13 @@ var ( // shared vars
|
||||
rpcPoolFirst, rpcPoolBroadcast *rpcclient.RpcClientPool
|
||||
ral1, ral2 *exec.Cmd
|
||||
err error
|
||||
ral1ID, ral2ID, ralRmtID string
|
||||
node1 = "node1"
|
||||
node2 = "node2"
|
||||
)
|
||||
|
||||
var ( // configuration opts
|
||||
RemoteRALsAddr1 = "172.16.254.80:2012"
|
||||
RemoteRALsAddr2 = "127.0.0.1:2012"
|
||||
RemoteRALsAddr1 = "192.168.244.137:2012"
|
||||
RemoteRALsAddr2 = "192.168.244.138:2012"
|
||||
)
|
||||
|
||||
func TestRPCITLclInitCfg(t *testing.T) {
|
||||
@@ -98,13 +99,11 @@ func TestRPCITLclStatusSecondEngine(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else {
|
||||
ral2ID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil { // Make sure second time we land on the same instance
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) != ral2ID {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", ral2ID, status[utils.NodeID].(string))
|
||||
} else if status[utils.NodeID].(string) != node2 {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", node2, status[utils.NodeID].(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,15 +121,13 @@ func TestRPCITLclStatusFirstInitial(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) == ral2ID {
|
||||
} else if status[utils.NodeID].(string) == node2 {
|
||||
t.Fatalf("Should receive ralID different than second one, got: %s", status[utils.NodeID].(string))
|
||||
} else {
|
||||
ral1ID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil { // Make sure second time we land on the same instance
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) != ral1ID {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", ral1ID, status[utils.NodeID].(string))
|
||||
} else if status[utils.NodeID].(string) != node1 {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", node1, status[utils.NodeID].(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,15 +142,13 @@ func TestRPCITLclStatusFirstFailover(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) == ral1ID {
|
||||
} else if status[utils.NodeID].(string) == node1 {
|
||||
t.Fatalf("Should receive ralID different than first one, got: %s", status[utils.NodeID].(string))
|
||||
} else {
|
||||
ral2ID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil { // Make sure second time we land on the same instance
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) != ral2ID {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", ral2ID, status[utils.NodeID].(string))
|
||||
} else if status[utils.NodeID].(string) != node2 {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", node2, status[utils.NodeID].(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,15 +159,13 @@ func TestRPCITLclStatusFirstFailback(t *testing.T) {
|
||||
var status map[string]interface{}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == ral2ID {
|
||||
} else if status[utils.NodeID].(string) == node2 {
|
||||
t.Error("Should receive new ID")
|
||||
} else {
|
||||
ral1ID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil { // Make sure second time we land on the same instance
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) != ral1ID {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", ral1ID, status[utils.NodeID].(string))
|
||||
} else if status[utils.NodeID].(string) != node1 {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", node2, status[utils.NodeID].(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,13 +335,11 @@ func TestRPCITRmtStatusFirstInitial(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else {
|
||||
ralRmtID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil { // Make sure second time we land on the same instance
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) != ralRmtID {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", ralRmtID, status[utils.NodeID].(string))
|
||||
} else if status[utils.NodeID].(string) != node1 {
|
||||
t.Errorf("Expecting:\n%s\nReceived:\n%s", node1, status[utils.NodeID].(string))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,16 +359,14 @@ func TestRPCITRmtStatusFirstFailover(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) == ralRmtID {
|
||||
} else if status[utils.NodeID].(string) == node1 {
|
||||
t.Fatal("Did not failover")
|
||||
} else {
|
||||
ralRmtID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) != ralRmtID {
|
||||
} else if status[utils.NodeID].(string) != node2 {
|
||||
t.Fatal("Did not do failover")
|
||||
}
|
||||
}
|
||||
@@ -398,16 +387,14 @@ func TestRPCITRmtStatusFirstFailback(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) == ralRmtID {
|
||||
} else if status[utils.NodeID].(string) == node2 {
|
||||
t.Fatal("Did not do failback")
|
||||
} else {
|
||||
ralRmtID = status[utils.NodeID].(string)
|
||||
}
|
||||
if err := rpcPoolFirst.Call("Responder.Status", "", &status); err != nil {
|
||||
t.Error(err)
|
||||
} else if status[utils.NodeID].(string) == "" {
|
||||
t.Error("Empty NodeID received")
|
||||
} else if status[utils.NodeID].(string) != ralRmtID {
|
||||
} else if status[utils.NodeID].(string) != node1 {
|
||||
t.Fatal("Did not do failback")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user