package com.playtika.test.redis.wait;

import com.playtika.test.common.checks.AbstractCommandWaitStrategy;
import com.playtika.test.redis.RedisProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
public class RedisStatusCheck extends AbstractCommandWaitStrategy {

    private final RedisProperties properties;

    @Override
    public String[] getCheckCommand() {
        return new String[] {
                "redis-cli", "-a", "$REDIS_PASSWORD", "-p", String.valueOf(properties.getPort()), "ping"
        };
    }
}

@@ -424,16 +424,62 @@
 and() %7B%0A
+        if (properties.isRequirepass()) %7B%0A    
         
@@ -497,17 +497,16 @@
 String%5B%5D
- 
 %7B%0A      
@@ -515,16 +515,20 @@
         
+    
 %22redis-c
@@ -542,24 +542,180 @@
 a%22, 
-%22$REDIS_PASSWORD
+properties.getPassword(), %22-p%22, String.valueOf(properties.getPort()), %22ping%22%0A            %7D;%0A        %7D else %7B%0A            return new String%5B%5D%7B%0A                    %22redis-cli
 %22, %22
@@ -768,23 +768,37 @@
 ng%22%0A        
+    %7D;%0A        
 %7D
-;
 %0A    %7D%0A%7D%0A

Fix Redis startup failure (#737)