Add option compatibility for DockerComposeContainer to work locally with docker compose
This commit is contained in:
		
							parent
							
								
									c2a87aba60
								
							
						
					
					
						commit
						72423991b9
					
				@ -156,6 +156,7 @@ public class ContainerTestSuite {
 | 
			
		||||
            testContainer = new DockerComposeContainerImpl<>(composeFiles)
 | 
			
		||||
                    .withPull(false)
 | 
			
		||||
                    .withLocalCompose(true)
 | 
			
		||||
                    .withOptions("--compatibility")
 | 
			
		||||
                    .withTailChildContainers(!skipTailChildContainers)
 | 
			
		||||
                    .withEnv(installTb.getEnv())
 | 
			
		||||
                    .withEnv(queueEnv)
 | 
			
		||||
 | 
			
		||||
@ -68,6 +68,7 @@ public class ThingsBoardDbInstaller {
 | 
			
		||||
 | 
			
		||||
    public ThingsBoardDbInstaller() {
 | 
			
		||||
        log.info("System property of blackBoxTests.redisCluster is {}", IS_REDIS_CLUSTER);
 | 
			
		||||
        log.info("System property of blackBoxTests.redisCluster is {}", IS_REDIS_SENTINEL);
 | 
			
		||||
        log.info("System property of blackBoxTests.hybridMode is {}", IS_HYBRID_MODE);
 | 
			
		||||
        List<File> composeFiles = new ArrayList<>(Arrays.asList(
 | 
			
		||||
                new File("./../../docker/docker-compose.yml"),
 | 
			
		||||
@ -240,13 +241,22 @@ public class ThingsBoardDbInstaller {
 | 
			
		||||
 | 
			
		||||
        dockerCompose.withCommand("volume rm -f " + postgresDataVolume + " " + tbLogVolume +
 | 
			
		||||
                " " + tbCoapTransportLogVolume + " " + tbLwm2mTransportLogVolume + " " + tbHttpTransportLogVolume +
 | 
			
		||||
                " " + tbMqttTransportLogVolume + " " + tbSnmpTransportLogVolume + " " + tbVcExecutorLogVolume +
 | 
			
		||||
                (IS_REDIS_CLUSTER
 | 
			
		||||
                        ? IntStream.range(0, 6).mapToObj(i -> " " + redisClusterDataVolume + '-' + i).collect(Collectors.joining())
 | 
			
		||||
                        : redisDataVolume));
 | 
			
		||||
                " " + tbMqttTransportLogVolume + " " + tbSnmpTransportLogVolume + " " + tbVcExecutorLogVolume + resolveComposeVolumeLog());
 | 
			
		||||
        dockerCompose.invokeDocker();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String resolveComposeVolumeLog() {
 | 
			
		||||
        if (IS_REDIS_CLUSTER) {
 | 
			
		||||
            return IntStream.range(0, 6).mapToObj(i -> " " + redisClusterDataVolume + "-" + i).collect(Collectors.joining());
 | 
			
		||||
        }
 | 
			
		||||
        if (IS_REDIS_SENTINEL) {
 | 
			
		||||
            return redisSentinelDataVolume + "-" + "master " + " " +
 | 
			
		||||
                    redisSentinelDataVolume + "-" + "slave" + " " +
 | 
			
		||||
                    redisSentinelDataVolume + " " + "sentinel";
 | 
			
		||||
        }
 | 
			
		||||
        return redisDataVolume;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void copyLogs(String volumeName, String targetDir) {
 | 
			
		||||
        File tbLogsDir = new File(targetDir);
 | 
			
		||||
        tbLogsDir.mkdirs();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user