Skip to content

Commit 89548ee

Browse files
committed
feat(e2e-test): Extended e2e tests
1 parent 228d4e5 commit 89548ee

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

maintnotifications/e2e/scenario_endpoint_types_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package e2e
33
import (
44
"context"
55
"fmt"
6+
"net"
67
"os"
78
"strings"
89
"testing"
910
"time"
1011

12+
"github.com/redis/go-redis/v9/internal"
1113
logs2 "github.com/redis/go-redis/v9/internal/maintnotifications/logs"
1214
"github.com/redis/go-redis/v9/logging"
1315
"github.com/redis/go-redis/v9/maintnotifications"
@@ -273,6 +275,38 @@ func TestEndpointTypesPushNotifications(t *testing.T) {
273275
movingData := logs2.ExtractDataFromLogMessage(match)
274276
p("MOVING notification received for %s. %v", endpointTest.name, movingData)
275277

278+
notification, ok := movingData["notification"].(string)
279+
if !ok {
280+
e("invalid notification message")
281+
}
282+
283+
notification = notification[:len(notification)-1]
284+
notificationParts := strings.Split(notification, " ")
285+
address := notificationParts[len(notificationParts)-1]
286+
287+
switch endpointTest.endpointType {
288+
case maintnotifications.EndpointTypeExternalFQDN:
289+
address = strings.Split(address, ":")[0]
290+
address = strings.SplitN(address, ".", 2)[1]
291+
292+
expectedAddress := strings.SplitN(endpointConfig.Host, ".", 2)[1]
293+
294+
if address != expectedAddress {
295+
e("invalid fqdn, expected: %s, got: %s", expectedAddress, address)
296+
}
297+
298+
case maintnotifications.EndpointTypeExternalIP:
299+
address = strings.Split(address, ":")[0]
300+
ip := net.ParseIP(address)
301+
if ip == nil {
302+
e("invalid message format, expected valid IP, got: %s", address)
303+
}
304+
case maintnotifications.EndpointTypeNone:
305+
if address != internal.RedisNull {
306+
e("invalid endpoint type, expected: %s, got: %s", internal.RedisNull, address)
307+
}
308+
}
309+
276310
// Wait for bind to complete
277311
bindStatus, err := faultInjector.WaitForAction(ctx, bindResp.ActionID,
278312
WithMaxWaitTime(120*time.Second),

0 commit comments

Comments
 (0)