@@ -237,10 +237,12 @@ func TestCreateUpstreams(t *testing.T) {
237237 Address : "12.0.0.0:80" ,
238238 },
239239 },
240- KeepAliveConnections : 1 ,
241- KeepAliveRequests : 1 ,
242- KeepAliveTime : "5s" ,
243- KeepAliveTimeout : "10s" ,
240+ KeepAlive : http.UpstreamKeepAlive {
241+ Connections : 1 ,
242+ Requests : 1 ,
243+ Time : "5s" ,
244+ Timeout : "10s" ,
245+ },
244246 },
245247 {
246248 Name : invalidBackendRef ,
@@ -262,8 +264,8 @@ func TestCreateUpstream(t *testing.T) {
262264 gen := GeneratorImpl {}
263265 tests := []struct {
264266 msg string
265- stateUpstream dataplane.Upstream
266267 expectedUpstream http.Upstream
268+ stateUpstream dataplane.Upstream
267269 }{
268270 {
269271 stateUpstream : dataplane.Upstream {
@@ -389,10 +391,12 @@ func TestCreateUpstream(t *testing.T) {
389391 Address : "10.0.0.1:80" ,
390392 },
391393 },
392- KeepAliveConnections : 1 ,
393- KeepAliveRequests : 1 ,
394- KeepAliveTime : "5s" ,
395- KeepAliveTimeout : "10s" ,
394+ KeepAlive : http.UpstreamKeepAlive {
395+ Connections : 1 ,
396+ Requests : 1 ,
397+ Time : "5s" ,
398+ Timeout : "10s" ,
399+ },
396400 },
397401 msg : "single upstreamSettingsPolicy" ,
398402 },
@@ -441,10 +445,12 @@ func TestCreateUpstream(t *testing.T) {
441445 Address : "10.0.0.1:80" ,
442446 },
443447 },
444- KeepAliveConnections : 1 ,
445- KeepAliveRequests : 1 ,
446- KeepAliveTime : "5s" ,
447- KeepAliveTimeout : "10s" ,
448+ KeepAlive : http.UpstreamKeepAlive {
449+ Connections : 1 ,
450+ Requests : 1 ,
451+ Time : "5s" ,
452+ Timeout : "10s" ,
453+ },
448454 },
449455 msg : "multiple upstreamSettingsPolicies" ,
450456 },
@@ -511,10 +517,12 @@ func TestCreateUpstream(t *testing.T) {
511517 Address : "10.0.0.1:80" ,
512518 },
513519 },
514- KeepAliveConnections : 1 ,
515- KeepAliveRequests : 1 ,
516- KeepAliveTime : "5s" ,
517- KeepAliveTimeout : "10s" ,
520+ KeepAlive : http.UpstreamKeepAlive {
521+ Connections : 1 ,
522+ Requests : 1 ,
523+ Time : "5s" ,
524+ Timeout : "10s" ,
525+ },
518526 },
519527 msg : "upstreamSettingsPolicy with only keep alive settings" ,
520528 },
@@ -791,43 +799,53 @@ func TestKeepAliveEnabled(t *testing.T) {
791799 {
792800 msg : "upstream with all keepAlive fields set" ,
793801 upstream : http.Upstream {
794- Name : "upAllKeepAliveFieldsSet" ,
795- KeepAliveConnections : 1 ,
796- KeepAliveRequests : 1 ,
797- KeepAliveTime : "5s" ,
798- KeepAliveTimeout : "10s" ,
802+ Name : "upAllKeepAliveFieldsSet" ,
803+ KeepAlive : http.UpstreamKeepAlive {
804+ Connections : 1 ,
805+ Requests : 1 ,
806+ Time : "5s" ,
807+ Timeout : "10s" ,
808+ },
799809 },
800810 expKeepAliveEnabled : true ,
801811 },
802812 {
803813 msg : "upstream with keepAlive connection field set" ,
804814 upstream : http.Upstream {
805- Name : "upKeepAliveConnectionsSet" ,
806- KeepAliveConnections : 1 ,
815+ Name : "upKeepAliveConnectionsSet" ,
816+ KeepAlive : http.UpstreamKeepAlive {
817+ Connections : 1 ,
818+ },
807819 },
808820 expKeepAliveEnabled : true ,
809821 },
810822 {
811823 msg : "upstream with keepAlive requests field set" ,
812824 upstream : http.Upstream {
813- Name : "upKeepAliveRequestsSet" ,
814- KeepAliveRequests : 1 ,
825+ Name : "upKeepAliveRequestsSet" ,
826+ KeepAlive : http.UpstreamKeepAlive {
827+ Requests : 1 ,
828+ },
815829 },
816830 expKeepAliveEnabled : true ,
817831 },
818832 {
819833 msg : "upstream with keepAlive time field set" ,
820834 upstream : http.Upstream {
821- Name : "upKeepAliveTimeSet" ,
822- KeepAliveTime : "5s" ,
835+ Name : "upKeepAliveTimeSet" ,
836+ KeepAlive : http.UpstreamKeepAlive {
837+ Time : "5s" ,
838+ },
823839 },
824840 expKeepAliveEnabled : true ,
825841 },
826842 {
827843 msg : "upstream with keepAlive timeout field set" ,
828844 upstream : http.Upstream {
829- Name : "upKeepAliveTimeoutSet" ,
830- KeepAliveTimeout : "10s" ,
845+ Name : "upKeepAliveTimeoutSet" ,
846+ KeepAlive : http.UpstreamKeepAlive {
847+ Timeout : "10s" ,
848+ },
831849 },
832850 expKeepAliveEnabled : true ,
833851 },
@@ -841,11 +859,13 @@ func TestKeepAliveEnabled(t *testing.T) {
841859 {
842860 msg : "upstream with keepAlive fields set to empty values" ,
843861 upstream : http.Upstream {
844- Name : "upNoKeepAliveFieldsSet" ,
845- KeepAliveConnections : 0 ,
846- KeepAliveRequests : 0 ,
847- KeepAliveTime : "" ,
848- KeepAliveTimeout : "" ,
862+ Name : "upNoKeepAliveFieldsSet" ,
863+ KeepAlive : http.UpstreamKeepAlive {
864+ Connections : 0 ,
865+ Requests : 0 ,
866+ Time : "" ,
867+ Timeout : "" ,
868+ },
849869 },
850870 expKeepAliveEnabled : false ,
851871 },
0 commit comments