Skip to content

Commit bc3fe0b

Browse files
committed
imroved e2e test resiliency
1 parent 89548ee commit bc3fe0b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,20 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
287287
switch endpointTest.endpointType {
288288
case maintnotifications.EndpointTypeExternalFQDN:
289289
address = strings.Split(address, ":")[0]
290-
address = strings.SplitN(address, ".", 2)[1]
291-
292-
expectedAddress := strings.SplitN(endpointConfig.Host, ".", 2)[1]
290+
addressParts := strings.SplitN(address, ".", 2)
291+
if len(addressParts) != 2 {
292+
e("invalid address %s", address)
293+
} else {
294+
address = addressParts[1]
295+
}
293296

297+
var expectedAddress string
298+
hostParts := strings.SplitN(endpointConfig.Host, ".", 2)
299+
if len(hostParts) != 2 {
300+
e("invalid host %s", endpointConfig.Host)
301+
} else {
302+
expectedAddress = hostParts[1]
303+
}
294304
if address != expectedAddress {
295305
e("invalid fqdn, expected: %s, got: %s", expectedAddress, address)
296306
}

0 commit comments

Comments
 (0)