Skip to content

Commit

Permalink
use password only when set
Browse files Browse the repository at this point in the history
  • Loading branch information
Pothulapati committed Oct 6, 2023
1 parent 4161c3c commit fa526c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion e2e/dragonfly_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ var _ = Describe("Dragonfly PVC Test with single replica", Ordered, func() {

// Insert Data
stopChan := make(chan struct{}, 1)
rc, err := checkAndK8sPortForwardRedis(ctx, stopChan, name, namespace, "df-pass-1")
rc, err := checkAndK8sPortForwardRedis(ctx, stopChan, name, namespace, "")
defer close(stopChan)
Expect(err).To(BeNil())

Expand Down
13 changes: 9 additions & 4 deletions e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,15 @@ func checkAndK8sPortForwardRedis(ctx context.Context, stopChan chan struct{}, na
return nil, err
}

redisClient := redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("localhost:%d", resources.DragonflyPort),
Password: password,
})
redisOptions := &redis.Options{
Addr: fmt.Sprintf("localhost:%d", resources.DragonflyPort),
}

if password != "" {
redisOptions.Password = password
}

redisClient := redis.NewClient(redisOptions)

errChan := make(chan error, 1)
go func() { errChan <- fw.ForwardPorts() }()
Expand Down

0 comments on commit fa526c2

Please sign in to comment.