@@ -24,6 +24,7 @@ import (
2424 clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
2525 listenerv3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
2626 routev3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
27+ hcmv3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
2728 cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3"
2829 resourcev3 "github.com/envoyproxy/go-control-plane/pkg/resource/v3"
2930)
@@ -116,6 +117,10 @@ func TestXdsServer_UpdateSnapshot(t *testing.T) {
116117 if fallbackRoute .GetMatch ().GetPrefix () != "/" {
117118 t .Errorf ("Expected path mapping prefix '/', got '%s'" , fallbackRoute .GetMatch ().GetPrefix ())
118119 }
120+ routeAction := fallbackRoute .GetRoute ()
121+ if len (routeAction .GetUpgradeConfigs ()) != 1 || routeAction .GetUpgradeConfigs ()[0 ].GetUpgradeType () != websocketUpgradeType {
122+ t .Errorf ("Expected route websocket upgrade config, got %+v" , routeAction .GetUpgradeConfigs ())
123+ }
119124 }
120125
121126 // Verify listeners generated
@@ -135,6 +140,15 @@ func TestXdsServer_UpdateSnapshot(t *testing.T) {
135140 if sa .GetAddress () != "0.0.0.0" {
136141 t .Errorf ("Expected address '0.0.0.0', got %s" , sa .GetAddress ())
137142 }
143+
144+ hcmAny := l .GetFilterChains ()[0 ].GetFilters ()[0 ].GetTypedConfig ()
145+ hcm := & hcmv3.HttpConnectionManager {}
146+ if err := hcmAny .UnmarshalTo (hcm ); err != nil {
147+ t .Fatalf ("Failed to unmarshal HCM: %v" , err )
148+ }
149+ if len (hcm .GetUpgradeConfigs ()) != 1 || hcm .GetUpgradeConfigs ()[0 ].GetUpgradeType () != websocketUpgradeType {
150+ t .Errorf ("Expected HCM websocket upgrade config, got %+v" , hcm .GetUpgradeConfigs ())
151+ }
138152 }
139153}
140154
0 commit comments