msa black box tests: redis-cluster test implemented with mvn -DblackBoxTests.redisCluster=true
This commit is contained in:
parent
9801120384
commit
40823dd2c0
5
docker/cache-redis-cluster.env
Normal file
5
docker/cache-redis-cluster.env
Normal file
@ -0,0 +1,5 @@
|
||||
CACHE_TYPE=redis
|
||||
REDIS_CONNECTION_TYPE=cluster
|
||||
REDIS_NODES=redis-node-0:6379,redis-node-1:6379,redis-node-2:6379,redis-node-3:6379,redis-node-4:6379,redis-node-5:6379
|
||||
REDIS_USE_DEFAULT_POOL_CONFIG=false
|
||||
REDIS_PASSWORD=bitnami
|
||||
2
docker/cache-redis.env
Normal file
2
docker/cache-redis.env
Normal file
@ -0,0 +1,2 @@
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
@ -39,7 +39,6 @@ services:
|
||||
- tb-node.hybrid.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
- cassandra
|
||||
tb-core2:
|
||||
@ -47,7 +46,6 @@ services:
|
||||
- tb-node.hybrid.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
- cassandra
|
||||
tb-rule-engine1:
|
||||
@ -55,7 +53,6 @@ services:
|
||||
- tb-node.hybrid.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
- cassandra
|
||||
tb-rule-engine2:
|
||||
@ -63,6 +60,5 @@ services:
|
||||
- tb-node.hybrid.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
- cassandra
|
||||
|
||||
@ -36,25 +36,21 @@ services:
|
||||
- queue-kafka.env
|
||||
depends_on:
|
||||
- kafka
|
||||
- redis
|
||||
tb-core2:
|
||||
env_file:
|
||||
- queue-kafka.env
|
||||
depends_on:
|
||||
- kafka
|
||||
- redis
|
||||
tb-rule-engine1:
|
||||
env_file:
|
||||
- queue-kafka.env
|
||||
depends_on:
|
||||
- kafka
|
||||
- redis
|
||||
tb-rule-engine2:
|
||||
env_file:
|
||||
- queue-kafka.env
|
||||
depends_on:
|
||||
- kafka
|
||||
- redis
|
||||
tb-mqtt-transport1:
|
||||
env_file:
|
||||
- queue-kafka.env
|
||||
|
||||
@ -31,27 +31,19 @@ services:
|
||||
env_file:
|
||||
- tb-node.postgres.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
tb-core2:
|
||||
env_file:
|
||||
- tb-node.postgres.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
tb-rule-engine1:
|
||||
env_file:
|
||||
- tb-node.postgres.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
tb-rule-engine2:
|
||||
env_file:
|
||||
- tb-node.postgres.env
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- postgres
|
||||
|
||||
162
docker/docker-compose.redis-cluster.yml
Normal file
162
docker/docker-compose.redis-cluster.yml
Normal file
@ -0,0 +1,162 @@
|
||||
#
|
||||
# Copyright © 2016-2022 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
# Redis cluster
|
||||
redis-node-0:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-0:/bitnami/redis/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
|
||||
redis-node-1:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-1:/bitnami/redis/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
|
||||
redis-node-2:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-2:/bitnami/redis/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
|
||||
redis-node-3:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-3:/bitnami/redis/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
|
||||
redis-node-4:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-4:/bitnami/redis/data
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
|
||||
redis-node-5:
|
||||
image: bitnami/redis-cluster:7.0
|
||||
volumes:
|
||||
- redis-cluster_data-5:/bitnami/redis/data
|
||||
depends_on:
|
||||
- redis-node-0
|
||||
- redis-node-1
|
||||
- redis-node-2
|
||||
- redis-node-3
|
||||
- redis-node-4
|
||||
environment:
|
||||
- 'REDIS_PASSWORD=bitnami'
|
||||
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
|
||||
- 'REDISCLI_AUTH=bitnami'
|
||||
- 'REDIS_CLUSTER_REPLICAS=1'
|
||||
- 'REDIS_CLUSTER_CREATOR=yes'
|
||||
|
||||
# ThingsBoard setup to use redis-cluster
|
||||
tb-core1:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-core2:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-rule-engine1:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-rule-engine2:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-mqtt-transport1:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-mqtt-transport2:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-http-transport1:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-http-transport2:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-coap-transport:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-lwm2m-transport:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-snmp-transport:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-vc-executor1:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
tb-vc-executor2:
|
||||
env_file:
|
||||
- cache-redis-cluster.env
|
||||
depends_on:
|
||||
- redis-node-5
|
||||
volumes:
|
||||
redis-cluster_data-0:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_0}
|
||||
redis-cluster_data-1:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_1}
|
||||
redis-cluster_data-2:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_2}
|
||||
redis-cluster_data-3:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_3}
|
||||
redis-cluster_data-4:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_4}
|
||||
redis-cluster_data-5:
|
||||
external: true
|
||||
name: ${REDIS_CLUSTER_DATA_VOLUME_5}
|
||||
102
docker/docker-compose.redis.yml
Normal file
102
docker/docker-compose.redis.yml
Normal file
@ -0,0 +1,102 @@
|
||||
#
|
||||
# Copyright © 2016-2022 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
# Redis standalone
|
||||
redis:
|
||||
restart: always
|
||||
image: bitnami/redis:7.0
|
||||
environment:
|
||||
# ALLOW_EMPTY_PASSWORD is recommended only for development.
|
||||
ALLOW_EMPTY_PASSWORD: "yes"
|
||||
ports:
|
||||
- '6379:6379'
|
||||
volumes:
|
||||
- 'redis_data:/bitnami/redis/data'
|
||||
|
||||
# ThingsBoard setup to use redis-standalone
|
||||
tb-core1:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-core2:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-rule-engine1:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-rule-engine2:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-mqtt-transport1:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-mqtt-transport2:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-http-transport1:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-http-transport2:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-coap-transport:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-lwm2m-transport:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-snmp-transport:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-vc-executor1:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
tb-vc-executor2:
|
||||
env_file:
|
||||
- cache-redis.env
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
external: true
|
||||
name: ${REDIS_DATA_VOLUME}
|
||||
@ -26,15 +26,10 @@ services:
|
||||
environment:
|
||||
ZOO_MY_ID: 1
|
||||
ZOO_SERVERS: server.1=zookeeper:2888:3888;zookeeper:2181
|
||||
redis:
|
||||
restart: always
|
||||
image: redis:4.0
|
||||
ports:
|
||||
- "6379"
|
||||
tb-js-executor:
|
||||
restart: always
|
||||
image: "${DOCKER_REPO}/${JS_EXECUTOR_DOCKER_NAME}:${TB_VERSION}"
|
||||
scale: 20
|
||||
scale: 10
|
||||
env_file:
|
||||
- tb-js-executor.env
|
||||
tb-core1:
|
||||
@ -59,7 +54,6 @@ services:
|
||||
- ./tb-node/log:/var/log/thingsboard
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- tb-js-executor
|
||||
- tb-rule-engine1
|
||||
- tb-rule-engine2
|
||||
@ -85,7 +79,6 @@ services:
|
||||
- ./tb-node/log:/var/log/thingsboard
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- tb-js-executor
|
||||
- tb-rule-engine1
|
||||
- tb-rule-engine2
|
||||
@ -109,7 +102,6 @@ services:
|
||||
- ./tb-node/log:/var/log/thingsboard
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- tb-js-executor
|
||||
tb-rule-engine2:
|
||||
restart: always
|
||||
@ -131,7 +123,6 @@ services:
|
||||
- ./tb-node/log:/var/log/thingsboard
|
||||
depends_on:
|
||||
- zookeeper
|
||||
- redis
|
||||
- tb-js-executor
|
||||
tb-mqtt-transport1:
|
||||
restart: always
|
||||
|
||||
@ -48,9 +48,9 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $?
|
||||
|
||||
if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d redis $ADDITIONAL_STARTUP_SERVICES
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d redis $ADDITIONAL_STARTUP_SERVICES
|
||||
fi
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb-core1
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb-core1
|
||||
|
||||
|
||||
|
||||
@ -25,4 +25,4 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
|
||||
ADDITIONAL_COMPOSE_MONITORING_ARGS=$(additionalComposeMonitoringArgs) || exit $?
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS down -v
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS down -v
|
||||
|
||||
@ -25,4 +25,4 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
|
||||
ADDITIONAL_COMPOSE_MONITORING_ARGS=$(additionalComposeMonitoringArgs) || exit $?
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS up -d
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS up -d
|
||||
|
||||
@ -25,4 +25,4 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
|
||||
ADDITIONAL_COMPOSE_MONITORING_ARGS=$(additionalComposeMonitoringArgs) || exit $?
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS stop
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS $ADDITIONAL_COMPOSE_MONITORING_ARGS stop
|
||||
|
||||
@ -23,5 +23,5 @@ ADDITIONAL_COMPOSE_QUEUE_ARGS=$(additionalComposeQueueArgs) || exit $?
|
||||
|
||||
ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS pull $@
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d --no-deps --build $@
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS pull $@
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d --no-deps --build $@
|
||||
|
||||
@ -46,8 +46,8 @@ ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
|
||||
|
||||
ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $?
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS pull tb-core1
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS pull tb-core1
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d redis $ADDITIONAL_STARTUP_SERVICES
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS up -d redis $ADDITIONAL_STARTUP_SERVICES
|
||||
|
||||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb-core1
|
||||
docker-compose -f docker-compose.yml docker-compose.redis.yml $ADDITIONAL_COMPOSE_ARGS $ADDITIONAL_COMPOSE_QUEUE_ARGS run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb-core1
|
||||
|
||||
@ -10,6 +10,3 @@ METRICS_ENDPOINTS_EXPOSE=prometheus
|
||||
WEB_APPLICATION_ENABLE=true
|
||||
WEB_APPLICATION_TYPE=servlet
|
||||
HTTP_BIND_PORT=8081
|
||||
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
@ -7,6 +7,3 @@ HTTP_REQUEST_TIMEOUT=60000
|
||||
|
||||
METRICS_ENABLED=true
|
||||
METRICS_ENDPOINTS_EXPOSE=prometheus
|
||||
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
@ -10,6 +10,3 @@ METRICS_ENDPOINTS_EXPOSE=prometheus
|
||||
WEB_APPLICATION_ENABLE=true
|
||||
WEB_APPLICATION_TYPE=servlet
|
||||
HTTP_BIND_PORT=8081
|
||||
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
@ -10,6 +10,3 @@ METRICS_ENDPOINTS_EXPOSE=prometheus
|
||||
WEB_APPLICATION_ENABLE=true
|
||||
WEB_APPLICATION_TYPE=servlet
|
||||
HTTP_BIND_PORT=8081
|
||||
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
@ -4,8 +4,6 @@ ZOOKEEPER_ENABLED=true
|
||||
ZOOKEEPER_URL=zookeeper:2181
|
||||
JS_EVALUATOR=remote
|
||||
TRANSPORT_TYPE=remote
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
HTTP_LOG_CONTROLLER_ERROR_STACK_TRACE=false
|
||||
|
||||
|
||||
@ -6,6 +6,3 @@ METRICS_ENDPOINTS_EXPOSE=prometheus
|
||||
WEB_APPLICATION_ENABLE=true
|
||||
WEB_APPLICATION_TYPE=servlet
|
||||
HTTP_BIND_PORT=8081
|
||||
|
||||
CACHE_TYPE=redis
|
||||
REDIS_HOST=redis
|
||||
|
||||
@ -18,8 +18,13 @@ As result, in REPOSITORY column, next images should be present:
|
||||
thingsboard/tb-web-ui
|
||||
thingsboard/tb-js-executor
|
||||
|
||||
- Run the black box tests in the [msa/black-box-tests](../black-box-tests) directory:
|
||||
- Run the black box tests in the [msa/black-box-tests](../black-box-tests) directory with Redis standalone:
|
||||
|
||||
mvn clean install -DblackBoxTests.skip=false
|
||||
|
||||
- Run the black box tests in the [msa/black-box-tests](../black-box-tests) directory with Redis cluster:
|
||||
|
||||
mvn clean install -DblackBoxTests.skip=false -DblackBoxTests.redisCluster=true
|
||||
|
||||
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ import static org.junit.Assert.fail;
|
||||
@ClasspathSuite.ClassnameFilters({"org.thingsboard.server.msa.*Test"})
|
||||
@Slf4j
|
||||
public class ContainerTestSuite {
|
||||
|
||||
final static boolean IS_REDIS_CLUSTER = Boolean.parseBoolean(System.getProperty("blackBoxTests.redisCluster"));
|
||||
private static final String SOURCE_DIR = "./../../docker/";
|
||||
private static final String TB_CORE_LOG_REGEXP = ".*Starting polling for events.*";
|
||||
private static final String TRANSPORTS_LOG_REGEXP = ".*Going to recalculate partitions.*";
|
||||
@ -52,6 +52,7 @@ public class ContainerTestSuite {
|
||||
@ClassRule
|
||||
public static DockerComposeContainer getTestContainer() {
|
||||
if (testContainer == null) {
|
||||
log.info("System property of blackBoxTests.redisCluster is {}", IS_REDIS_CLUSTER);
|
||||
boolean skipTailChildContainers = Boolean.valueOf(System.getProperty("blackBoxTests.skipTailChildContainers"));
|
||||
try {
|
||||
final String targetDir = FileUtils.getTempDirectoryPath() + "/" + "ContainerTestSuite-" + UUID.randomUUID() + "/";
|
||||
@ -75,7 +76,10 @@ public class ContainerTestSuite {
|
||||
new File(targetDir + "docker-compose.yml"),
|
||||
new File(targetDir + "docker-compose.postgres.yml"),
|
||||
new File(targetDir + "docker-compose.postgres.volumes.yml"),
|
||||
new File(targetDir + "docker-compose.kafka.yml"))
|
||||
new File(targetDir + "docker-compose.kafka.yml"),
|
||||
IS_REDIS_CLUSTER
|
||||
? new File("./../../docker/docker-compose.redis-cluster.yml")
|
||||
: new File("./../../docker/docker-compose.redis.yml"))
|
||||
.withPull(false)
|
||||
.withLocalCompose(true)
|
||||
.withTailChildContainers(!skipTailChildContainers)
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.thingsboard.server.msa;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.testcontainers.utility.Base58;
|
||||
@ -24,10 +25,16 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@Slf4j
|
||||
public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
|
||||
final static boolean IS_REDIS_CLUSTER = Boolean.parseBoolean(System.getProperty("blackBoxTests.redisCluster"));
|
||||
private final static String POSTGRES_DATA_VOLUME = "tb-postgres-test-data-volume";
|
||||
private final static String REDIS_DATA_VOLUME = "tb-redis-data-volume";
|
||||
private final static String REDIS_CLUSTER_DATA_VOLUME = "tb-redis-cluster-data-volume";
|
||||
private final static String TB_LOG_VOLUME = "tb-log-test-volume";
|
||||
private final static String TB_COAP_TRANSPORT_LOG_VOLUME = "tb-coap-transport-log-test-volume";
|
||||
private final static String TB_LWM2M_TRANSPORT_LOG_VOLUME = "tb-lwm2m-transport-log-test-volume";
|
||||
@ -39,6 +46,9 @@ public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
private final DockerComposeExecutor dockerCompose;
|
||||
|
||||
private final String postgresDataVolume;
|
||||
|
||||
private final String redisDataVolume;
|
||||
private final String redisClusterDataVolume;
|
||||
private final String tbLogVolume;
|
||||
private final String tbCoapTransportLogVolume;
|
||||
private final String tbLwm2mTransportLogVolume;
|
||||
@ -49,14 +59,21 @@ public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
private final Map<String, String> env;
|
||||
|
||||
public ThingsBoardDbInstaller() {
|
||||
log.info("System property of blackBoxTests.redisCluster is {}", IS_REDIS_CLUSTER);
|
||||
List<File> composeFiles = Arrays.asList(new File("./../../docker/docker-compose.yml"),
|
||||
new File("./../../docker/docker-compose.postgres.yml"),
|
||||
new File("./../../docker/docker-compose.postgres.volumes.yml"));
|
||||
new File("./../../docker/docker-compose.postgres.volumes.yml"),
|
||||
IS_REDIS_CLUSTER
|
||||
? new File("./../../docker/docker-compose.redis-cluster.yml")
|
||||
: new File("./../../docker/docker-compose.redis.yml")
|
||||
);
|
||||
|
||||
String identifier = Base58.randomString(6).toLowerCase();
|
||||
String project = identifier + Base58.randomString(6).toLowerCase();
|
||||
|
||||
postgresDataVolume = project + "_" + POSTGRES_DATA_VOLUME;
|
||||
redisDataVolume = project + "_" + REDIS_DATA_VOLUME;
|
||||
redisClusterDataVolume = project + "_" + REDIS_CLUSTER_DATA_VOLUME;
|
||||
tbLogVolume = project + "_" + TB_LOG_VOLUME;
|
||||
tbCoapTransportLogVolume = project + "_" + TB_COAP_TRANSPORT_LOG_VOLUME;
|
||||
tbLwm2mTransportLogVolume = project + "_" + TB_LWM2M_TRANSPORT_LOG_VOLUME;
|
||||
@ -76,6 +93,13 @@ public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
env.put("TB_MQTT_TRANSPORT_LOG_VOLUME", tbMqttTransportLogVolume);
|
||||
env.put("TB_SNMP_TRANSPORT_LOG_VOLUME", tbSnmpTransportLogVolume);
|
||||
env.put("TB_VC_EXECUTOR_LOG_VOLUME", tbVcExecutorLogVolume);
|
||||
if (IS_REDIS_CLUSTER) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
env.put("REDIS_CLUSTER_DATA_VOLUME_" + i, redisClusterDataVolume + '-' + i);
|
||||
}
|
||||
} else {
|
||||
env.put("REDIS_DATA_VOLUME", redisDataVolume);
|
||||
}
|
||||
dockerCompose.withEnv(env);
|
||||
}
|
||||
|
||||
@ -111,7 +135,20 @@ public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
dockerCompose.withCommand("volume create " + tbVcExecutorLogVolume);
|
||||
dockerCompose.invokeDocker();
|
||||
|
||||
dockerCompose.withCommand("up -d redis postgres");
|
||||
String redisService = "";
|
||||
if (IS_REDIS_CLUSTER) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
redisService = redisService + " redis-node-" + i;
|
||||
dockerCompose.withCommand("volume create " + redisClusterDataVolume + '-' + i);
|
||||
dockerCompose.invokeDocker();
|
||||
}
|
||||
} else {
|
||||
redisService = "redis";
|
||||
dockerCompose.withCommand("volume create " + redisDataVolume);
|
||||
dockerCompose.invokeDocker();
|
||||
}
|
||||
|
||||
dockerCompose.withCommand("up -d postgres " + redisService);
|
||||
dockerCompose.invokeCompose();
|
||||
|
||||
dockerCompose.withCommand("run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=true tb-core1");
|
||||
@ -137,7 +174,10 @@ public class ThingsBoardDbInstaller extends ExternalResource {
|
||||
|
||||
dockerCompose.withCommand("volume rm -f " + postgresDataVolume + " " + tbLogVolume +
|
||||
" " + tbCoapTransportLogVolume + " " + tbLwm2mTransportLogVolume + " " + tbHttpTransportLogVolume +
|
||||
" " + tbMqttTransportLogVolume + " " + tbSnmpTransportLogVolume + " " + tbVcExecutorLogVolume);
|
||||
" " + tbMqttTransportLogVolume + " " + tbSnmpTransportLogVolume + " " + tbVcExecutorLogVolume +
|
||||
(IS_REDIS_CLUSTER
|
||||
? IntStream.range(0, 6).mapToObj(i -> " " + redisClusterDataVolume + '-' + i).collect(Collectors.joining())
|
||||
: redisDataVolume));
|
||||
dockerCompose.invokeDocker();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user