Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaysngupta committed Apr 23, 2024
1 parent 88923e3 commit 8c97e20
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/appgw/backendhttpsettings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ var _ = Describe("Test the creation of Backend http settings from Ingress defini

for _, setting := range httpSettings {
if *setting.Name == DefaultBackendHTTPSettingsName {
Expect(setting.Protocol).To(Equal(n.ApplicationGatewayProtocolHTTP), "default backend %s should have %s", *setting.Name, n.ApplicationGatewayProtocolHTTP)
Expect(probes[utils.GetLastChunkOfSlashed(*setting.Probe.ID)].Protocol).To(Equal(n.ApplicationGatewayProtocolHTTP), "default probe should have http")
Expect(setting.Protocol).To(Equal(n.ApplicationGatewayProtocolHTTPS), "default backend %s should have %s", *setting.Name, n.ApplicationGatewayProtocolHTTPS)
Expect(probes[utils.GetLastChunkOfSlashed(*setting.Probe.ID)].Protocol).To(Equal(n.ApplicationGatewayProtocolHTTPS), "default probe should have http")
continue
}

Expand Down Expand Up @@ -114,8 +114,8 @@ var _ = Describe("Test the creation of Backend http settings from Ingress defini

for _, setting := range httpSettings {
if *setting.Name == DefaultBackendHTTPSettingsName {
Expect(setting.Protocol).To(Equal(n.ApplicationGatewayProtocolHTTP), "default backend %s should have %s", *setting.Name, n.ApplicationGatewayProtocolHTTP)
Expect(probes[utils.GetLastChunkOfSlashed(*setting.Probe.ID)].Protocol).To(Equal(n.ApplicationGatewayProtocolHTTP), "default probe should have http")
Expect(setting.Protocol).To(Equal(n.ApplicationGatewayProtocolHTTPS), "default backend %s should have %s", *setting.Name, n.ApplicationGatewayProtocolHTTP)
Expect(probes[utils.GetLastChunkOfSlashed(*setting.Probe.ID)].Protocol).To(Equal(n.ApplicationGatewayProtocolHTTPS), "default probe should have http")
continue
}

Expand Down Expand Up @@ -154,7 +154,7 @@ var _ = Describe("Test the creation of Backend http settings from Ingress defini

for _, setting := range httpSettings {
if *setting.Name == DefaultBackendHTTPSettingsName {
Expect(int32(80)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
Expect(int32(443)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
} else if strings.Contains(*setting.Name, strconv.Itoa(int(tests.ContainerPort))) {
// http setting for ingress with service port as 80
Expect(tests.ContainerPort).To(Equal(*setting.Port), "setting %s backend port %d should be 9876", *setting.Name, *setting.Port)
Expand Down Expand Up @@ -189,7 +189,7 @@ var _ = Describe("Test the creation of Backend http settings from Ingress defini

for _, setting := range httpSettings {
if *setting.Name == DefaultBackendHTTPSettingsName {
Expect(int32(80)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
Expect(int32(443)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
} else if strings.Contains(*setting.Name, strconv.Itoa(int(tests.ContainerPort))) {
// http setting for ingress with service port as 80
Expect(tests.ContainerPort).To(Equal(*setting.Port), "setting %s backend port %d should be 9876", *setting.Name, *setting.Port)
Expand Down Expand Up @@ -238,7 +238,7 @@ var _ = Describe("Test the creation of Backend http settings from Ingress defini

for _, setting := range httpSettings {
if *setting.Name == DefaultBackendHTTPSettingsName {
Expect(int32(80)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
Expect(int32(443)).To(Equal(*setting.Port), "default backend port %d should be 80", *setting.Port)
} else if strings.Contains(*setting.Name, strconv.Itoa(int(tests.ContainerPort))) {
// http setting for ingress with service port as 80
Expect(tests.ContainerPort).To(Equal(*setting.Port), "setting %s backend port %d should be 9876", *setting.Name, *setting.Port)
Expand Down
21 changes: 18 additions & 3 deletions pkg/appgw/configbuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
-- "properties": {
-- "cookieBasedAffinity": "Disabled",
-- "pickHostNameFromBackendAddress": false,
-- "port": 80,
-- "port": 443,
-- "probe": {
-- "id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/probes/defaultprobe-Http"
-- "id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/probes/defaultprobe-Https"
-- },
-- "protocol": "Http",
-- "protocol": "Https",
-- "requestTimeout": 30
-- }
-- }
Expand Down Expand Up @@ -557,6 +557,21 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
-- "timeout": 30,
-- "unhealthyThreshold": 3
-- }
-- },
-- {
-- "id": "/subscriptions/--subscription--/resourceGroups/--resource-group--/providers/Microsoft.Network/applicationGateways/--app-gw-name--/probes/defaultprobe-Https",
-- "name": "defaultprobe-Https",
-- "properties": {
-- "host": "localhost",
-- "interval": 30,
-- "match": {},
-- "minServers": 0,
-- "path": "/",
-- "pickHostNameFromBackendHttpSettings": false,
-- "protocol": "Https",
-- "timeout": 30,
-- "unhealthyThreshold": 3
-- }
-- }
-- ],
-- "redirectConfigurations": [],
Expand Down

0 comments on commit 8c97e20

Please sign in to comment.