47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package vpnruntime
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeServiceTunnelKeepsVPNAsProfileNotTransportRule(t *testing.T) {
|
|
tunnel := NormalizeServiceTunnel(FabricServiceTunnel{}, "vpn-tunnel-1")
|
|
if tunnel.TunnelID != "vpn-tunnel-1" {
|
|
t.Fatalf("tunnel id = %q", tunnel.TunnelID)
|
|
}
|
|
if tunnel.ServiceKind != DefaultFabricTunnelServiceKind || tunnel.ServiceClass != DefaultFabricTunnelClass {
|
|
t.Fatalf("vpn defaults not applied: %+v", tunnel)
|
|
}
|
|
if tunnel.TransportOwner != DefaultFabricTransportOwner || tunnel.RouteVisibility != DefaultFabricRouteVisibility {
|
|
t.Fatalf("transport ownership defaults not applied: %+v", tunnel)
|
|
}
|
|
if tunnel.DataPlane != DefaultFabricTunnelDataPlane || tunnel.StreamShards != DefaultFabricServiceStreamShards {
|
|
t.Fatalf("data plane defaults not applied: %+v", tunnel)
|
|
}
|
|
if len(tunnel.TrafficClasses) < 5 {
|
|
t.Fatalf("traffic classes too small: %+v", tunnel.TrafficClasses)
|
|
}
|
|
}
|
|
|
|
func TestNormalizeServiceTunnelSupportsNonVPNService(t *testing.T) {
|
|
tunnel := NormalizeServiceTunnelWithDefaults(FabricServiceTunnel{}, "rdp-tunnel-1", FabricServiceTunnelDefaults{
|
|
PoolID: "desktop-exit",
|
|
ServiceKind: "rdp-client",
|
|
ServiceClass: "remote_desktop",
|
|
ServiceRole: "desktop-egress",
|
|
TrafficClasses: []string{
|
|
FabricServiceTrafficControl,
|
|
FabricServiceTrafficInteractive,
|
|
FabricServiceTrafficBulk,
|
|
},
|
|
StreamShards: 8,
|
|
})
|
|
if tunnel.TunnelID != "rdp-tunnel-1" || tunnel.PoolID != "desktop-exit" || tunnel.ServiceKind != "rdp-client" {
|
|
t.Fatalf("non-vpn tunnel defaults not applied: %+v", tunnel)
|
|
}
|
|
if tunnel.ServiceClass != "remote_desktop" || tunnel.ServiceRole != "desktop-egress" {
|
|
t.Fatalf("non-vpn service identity not applied: %+v", tunnel)
|
|
}
|
|
if tunnel.StreamShards != 8 || len(tunnel.TrafficClasses) != 3 {
|
|
t.Fatalf("non-vpn stream policy not applied: %+v", tunnel)
|
|
}
|
|
}
|