Skip to content

Commit 3d3670a

Browse files
committed
fix unit tests after rebase
1 parent 0815db9 commit 3d3670a

File tree

2 files changed

+102
-105
lines changed

2 files changed

+102
-105
lines changed

internal/mode/static/nginx/config/http/config.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ type Server struct {
1212

1313
// Location holds all configuration for an HTTP location.
1414
type Location struct {
15-
Path string
16-
ProxyPass string
17-
HTTPMatchKey string
18-
ProxySetHeaders []Header
19-
ProxySSLVerify *ProxySSLVerify
20-
Return *Return
21-
Rewrites []string
22-
HTTPMatchVar string
23-
AddResponseHeaders []Header
24-
SetResponseHeaders []Header
25-
RemoveResponseHeaders []string
26-
ResponseHeaders ResponseHeaders
15+
Path string
16+
ProxyPass string
17+
HTTPMatchKey string
18+
ProxySetHeaders []Header
19+
ProxySSLVerify *ProxySSLVerify
20+
Return *Return
21+
Rewrites []string
22+
HTTPMatchVar string
23+
ResponseHeaders ResponseHeaders
2724
}
2825

2926
// Header defines a HTTP header to be passed to the proxied server.

internal/mode/static/nginx/config/servers_test.go

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -590,48 +590,48 @@ func TestCreateServers(t *testing.T) {
590590

591591
return []http.Location{
592592
{
593-
Path: "@rule0-route0",
594-
ProxyPass: "http://test_foo_80$request_uri",
595-
ProxySetHeaders: baseHeaders,
596-
AddHeaderDirectives: baseHeaders,
593+
Path: "@rule0-route0",
594+
ProxyPass: "http://test_foo_80$request_uri",
595+
ProxySetHeaders: baseHeaders,
596+
ResponseHeaders: http.ResponseHeaders{},
597597
},
598598
{
599-
Path: "@rule0-route1",
600-
ProxyPass: "http://test_foo_80$request_uri",
601-
ProxySetHeaders: baseHeaders,
602-
AddHeaderDirectives: baseHeaders,
599+
Path: "@rule0-route1",
600+
ProxyPass: "http://test_foo_80$request_uri",
601+
ProxySetHeaders: baseHeaders,
602+
ResponseHeaders: http.ResponseHeaders{},
603603
},
604604
{
605-
Path: "@rule0-route2",
606-
ProxyPass: "http://test_foo_80$request_uri",
607-
ProxySetHeaders: baseHeaders,
608-
AddHeaderDirectives: baseHeaders,
605+
Path: "@rule0-route2",
606+
ProxyPass: "http://test_foo_80$request_uri",
607+
ProxySetHeaders: baseHeaders,
608+
ResponseHeaders: http.ResponseHeaders{},
609609
},
610610
{
611611
Path: "/",
612612
HTTPMatchKey: ssl + "1_0",
613613
},
614614
{
615-
Path: "@rule1-route0",
616-
ProxyPass: "http://$test__route1_rule1$request_uri",
617-
ProxySetHeaders: baseHeaders,
618-
AddHeaderDirectives: baseHeaders,
615+
Path: "@rule1-route0",
616+
ProxyPass: "http://$test__route1_rule1$request_uri",
617+
ProxySetHeaders: baseHeaders,
618+
ResponseHeaders: http.ResponseHeaders{},
619619
},
620620
{
621621
Path: "/test/",
622622
HTTPMatchKey: ssl + "1_1",
623623
},
624624
{
625-
Path: "/path-only/",
626-
ProxyPass: "http://invalid-backend-ref$request_uri",
627-
ProxySetHeaders: baseHeaders,
628-
AddHeaderDirectives: baseHeaders,
625+
Path: "/path-only/",
626+
ProxyPass: "http://invalid-backend-ref$request_uri",
627+
ProxySetHeaders: baseHeaders,
628+
ResponseHeaders: http.ResponseHeaders{},
629629
},
630630
{
631-
Path: "= /path-only",
632-
ProxyPass: "http://invalid-backend-ref$request_uri",
633-
ProxySetHeaders: baseHeaders,
634-
AddHeaderDirectives: baseHeaders,
631+
Path: "= /path-only",
632+
ProxyPass: "http://invalid-backend-ref$request_uri",
633+
ProxySetHeaders: baseHeaders,
634+
ResponseHeaders: http.ResponseHeaders{},
635635
},
636636
{
637637
Path: "/backend-tls-policy/",
@@ -695,25 +695,25 @@ func TestCreateServers(t *testing.T) {
695695
HTTPMatchKey: ssl + "1_6",
696696
},
697697
{
698-
Path: "/rewrite/",
699-
Rewrites: []string{"^ /replacement break"},
700-
ProxyPass: "http://test_foo_80",
701-
ProxySetHeaders: rewriteProxySetHeaders,
702-
AddHeaderDirectives: baseHeaders,
698+
Path: "/rewrite/",
699+
Rewrites: []string{"^ /replacement break"},
700+
ProxyPass: "http://test_foo_80",
701+
ProxySetHeaders: rewriteProxySetHeaders,
702+
ResponseHeaders: http.ResponseHeaders{},
703703
},
704704
{
705-
Path: "= /rewrite",
706-
Rewrites: []string{"^ /replacement break"},
707-
ProxyPass: "http://test_foo_80",
708-
ProxySetHeaders: rewriteProxySetHeaders,
709-
AddHeaderDirectives: baseHeaders,
705+
Path: "= /rewrite",
706+
Rewrites: []string{"^ /replacement break"},
707+
ProxyPass: "http://test_foo_80",
708+
ProxySetHeaders: rewriteProxySetHeaders,
709+
ResponseHeaders: http.ResponseHeaders{},
710710
},
711711
{
712-
Path: "@rule7-route0",
713-
Rewrites: []string{"^/rewrite-with-headers(.*)$ /prefix-replacement$1 break"},
714-
ProxyPass: "http://test_foo_80",
715-
ProxySetHeaders: rewriteProxySetHeaders,
716-
AddHeaderDirectives: baseHeaders,
712+
Path: "@rule8-route0",
713+
Rewrites: []string{"^/rewrite-with-headers(.*)$ /prefix-replacement$1 break"},
714+
ProxyPass: "http://test_foo_80",
715+
ProxySetHeaders: rewriteProxySetHeaders,
716+
ResponseHeaders: http.ResponseHeaders{},
717717
},
718718
{
719719
Path: "/rewrite-with-headers/",
@@ -750,16 +750,16 @@ func TestCreateServers(t *testing.T) {
750750
HTTPMatchKey: ssl + "1_10",
751751
},
752752
{
753-
Path: "= /exact",
754-
ProxyPass: "http://test_foo_80$request_uri",
755-
ProxySetHeaders: baseHeaders,
756-
AddHeaderDirectives: baseHeaders,
753+
Path: "= /exact",
754+
ProxyPass: "http://test_foo_80$request_uri",
755+
ProxySetHeaders: baseHeaders,
756+
ResponseHeaders: http.ResponseHeaders{},
757757
},
758758
{
759-
Path: "@rule11-route0",
760-
ProxyPass: "http://test_foo_80$request_uri",
761-
ProxySetHeaders: baseHeaders,
762-
AddHeaderDirectives: baseHeaders,
759+
Path: "@rule12-route0",
760+
ProxyPass: "http://test_foo_80$request_uri",
761+
ProxySetHeaders: baseHeaders,
762+
ResponseHeaders: http.ResponseHeaders{},
763763
},
764764
{
765765
Path: "= /test",
@@ -790,7 +790,7 @@ func TestCreateServers(t *testing.T) {
790790
Value: "$connection_upgrade",
791791
},
792792
},
793-
AddHeaderDirectives: baseHeaders,
793+
ResponseHeaders: http.ResponseHeaders{},
794794
},
795795
{
796796
Path: "= /proxy-set-headers",
@@ -817,7 +817,7 @@ func TestCreateServers(t *testing.T) {
817817
Value: "$connection_upgrade",
818818
},
819819
},
820-
AddHeaderDirectives: baseHeaders,
820+
ResponseHeaders: http.ResponseHeaders{},
821821
},
822822
}
823823
}
@@ -933,16 +933,16 @@ func TestCreateServersConflicts(t *testing.T) {
933933
},
934934
expLocs: []http.Location{
935935
{
936-
Path: "/coffee/",
937-
ProxyPass: "http://test_foo_80$request_uri",
938-
ProxySetHeaders: baseHeaders,
939-
AddHeaderDirectives: baseHeaders,
936+
Path: "/coffee/",
937+
ProxyPass: "http://test_foo_80$request_uri",
938+
ProxySetHeaders: baseHeaders,
939+
ResponseHeaders: http.ResponseHeaders{},
940940
},
941941
{
942-
Path: "= /coffee",
943-
ProxyPass: "http://test_bar_80$request_uri",
944-
ProxySetHeaders: baseHeaders,
945-
AddHeaderDirectives: baseHeaders,
942+
Path: "= /coffee",
943+
ProxyPass: "http://test_bar_80$request_uri",
944+
ProxySetHeaders: baseHeaders,
945+
ResponseHeaders: http.ResponseHeaders{},
946946
},
947947
createDefaultRootLocation(),
948948
},
@@ -973,16 +973,16 @@ func TestCreateServersConflicts(t *testing.T) {
973973
},
974974
expLocs: []http.Location{
975975
{
976-
Path: "= /coffee",
977-
ProxyPass: "http://test_foo_80$request_uri",
978-
ProxySetHeaders: baseHeaders,
979-
AddHeaderDirectives: baseHeaders,
976+
Path: "= /coffee",
977+
ProxyPass: "http://test_foo_80$request_uri",
978+
ProxySetHeaders: baseHeaders,
979+
ResponseHeaders: http.ResponseHeaders{},
980980
},
981981
{
982-
Path: "/coffee/",
983-
ProxyPass: "http://test_bar_80$request_uri",
984-
ProxySetHeaders: baseHeaders,
985-
AddHeaderDirectives: baseHeaders,
982+
Path: "/coffee/",
983+
ProxyPass: "http://test_bar_80$request_uri",
984+
ProxySetHeaders: baseHeaders,
985+
ResponseHeaders: http.ResponseHeaders{},
986986
},
987987
createDefaultRootLocation(),
988988
},
@@ -1023,16 +1023,16 @@ func TestCreateServersConflicts(t *testing.T) {
10231023
},
10241024
expLocs: []http.Location{
10251025
{
1026-
Path: "/coffee/",
1027-
ProxyPass: "http://test_bar_80$request_uri",
1028-
ProxySetHeaders: baseHeaders,
1029-
AddHeaderDirectives: baseHeaders,
1026+
Path: "/coffee/",
1027+
ProxyPass: "http://test_bar_80$request_uri",
1028+
ProxySetHeaders: baseHeaders,
1029+
ResponseHeaders: http.ResponseHeaders{},
10301030
},
10311031
{
1032-
Path: "= /coffee",
1033-
ProxyPass: "http://test_baz_80$request_uri",
1034-
ProxySetHeaders: baseHeaders,
1035-
AddHeaderDirectives: baseHeaders,
1032+
Path: "= /coffee",
1033+
ProxyPass: "http://test_baz_80$request_uri",
1034+
ProxySetHeaders: baseHeaders,
1035+
ResponseHeaders: http.ResponseHeaders{},
10361036
},
10371037
createDefaultRootLocation(),
10381038
},
@@ -1134,16 +1134,16 @@ func TestCreateLocationsRootPath(t *testing.T) {
11341134
pathRules: getPathRules(false /* rootPath */),
11351135
expLocations: []http.Location{
11361136
{
1137-
Path: "/path-1",
1138-
ProxyPass: "http://test_foo_80$request_uri",
1139-
ProxySetHeaders: baseHeaders,
1140-
AddHeaderDirectives: baseHeaders,
1137+
Path: "/path-1",
1138+
ProxyPass: "http://test_foo_80$request_uri",
1139+
ProxySetHeaders: baseHeaders,
1140+
ResponseHeaders: http.ResponseHeaders{},
11411141
},
11421142
{
1143-
Path: "/path-2",
1144-
ProxyPass: "http://test_foo_80$request_uri",
1145-
ProxySetHeaders: baseHeaders,
1146-
AddHeaderDirectives: baseHeaders,
1143+
Path: "/path-2",
1144+
ProxyPass: "http://test_foo_80$request_uri",
1145+
ProxySetHeaders: baseHeaders,
1146+
ResponseHeaders: http.ResponseHeaders{},
11471147
},
11481148
{
11491149
Path: "/",
@@ -1158,22 +1158,22 @@ func TestCreateLocationsRootPath(t *testing.T) {
11581158
pathRules: getPathRules(true /* rootPath */),
11591159
expLocations: []http.Location{
11601160
{
1161-
Path: "/path-1",
1162-
ProxyPass: "http://test_foo_80$request_uri",
1163-
ProxySetHeaders: baseHeaders,
1164-
AddHeaderDirectives: baseHeaders,
1161+
Path: "/path-1",
1162+
ProxyPass: "http://test_foo_80$request_uri",
1163+
ProxySetHeaders: baseHeaders,
1164+
ResponseHeaders: http.ResponseHeaders{},
11651165
},
11661166
{
1167-
Path: "/path-2",
1168-
ProxyPass: "http://test_foo_80$request_uri",
1169-
ProxySetHeaders: baseHeaders,
1170-
AddHeaderDirectives: baseHeaders,
1167+
Path: "/path-2",
1168+
ProxyPass: "http://test_foo_80$request_uri",
1169+
ProxySetHeaders: baseHeaders,
1170+
ResponseHeaders: http.ResponseHeaders{},
11711171
},
11721172
{
1173-
Path: "/",
1174-
ProxyPass: "http://test_foo_80$request_uri",
1175-
ProxySetHeaders: baseHeaders,
1176-
AddHeaderDirectives: baseHeaders,
1173+
Path: "/",
1174+
ProxyPass: "http://test_foo_80$request_uri",
1175+
ProxySetHeaders: baseHeaders,
1176+
ResponseHeaders: http.ResponseHeaders{},
11771177
},
11781178
},
11791179
},

0 commit comments

Comments
 (0)