35 lines
855 B
Go
35 lines
855 B
Go
package cluster
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestMeshLatestObservationKeySeparatesRouteHealthByRoute(t *testing.T) {
|
|
key := meshLatestObservationKey(json.RawMessage(`{
|
|
"observation_type":"synthetic_route_health",
|
|
"route_id":"route-1"
|
|
}`))
|
|
if key != "synthetic_route_health:route-1" {
|
|
t.Fatalf("key = %q", key)
|
|
}
|
|
}
|
|
|
|
func TestMeshLatestObservationKeySeparatesConnectionManagerMode(t *testing.T) {
|
|
key := meshLatestObservationKey(json.RawMessage(`{
|
|
"observation_type":"peer_connection_manager",
|
|
"transport_mode":"relay_control",
|
|
"relay_node_id":"node-r"
|
|
}`))
|
|
if key != "peer_connection_manager:relay_control:node-r" {
|
|
t.Fatalf("key = %q", key)
|
|
}
|
|
}
|
|
|
|
func TestMeshLatestObservationKeyDefaults(t *testing.T) {
|
|
key := meshLatestObservationKey(json.RawMessage(`{}`))
|
|
if key != "default" {
|
|
t.Fatalf("key = %q", key)
|
|
}
|
|
}
|