From aa6b81892f5cd2118b89d21f99073e841b59e8e2 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 22 Mar 2021 13:56:40 +0800 Subject: [PATCH 1/4] [TD-3368]output log of failed case --- tests/test-all.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/test-all.sh b/tests/test-all.sh index dcc2b61f43..b5e23c1506 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -79,24 +79,26 @@ function runSimCaseOneByOnefq { date +%F\ %T | tee -a out.log if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then echo -n $case - ./test.sh -f $case > /dev/null 2>&1 && \ + ./test.sh -f $case > ../../../sim/case.log 2>&1 && \ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ - echo -e "${RED} failed${NC}" | tee -a out.log + ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat ../../../sim/case.log ) else echo -n $case - ./test.sh -f $case > /dev/null 2>&1 && \ + ./test.sh -f $case > ../../sim/case.log 2>&1 && \ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ( grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ - echo -e "${RED} failed${NC}" | tee -a out.log + ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat ../../sim/case.log ) fi out_log=`tail -1 out.log ` if [[ $out_log =~ 'failed' ]];then if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then cp -r ../../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"` + rm -rf ../../../sim/case.log else cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` + rm -rf ../../sim/case.log fi exit 8 fi @@ -105,6 +107,8 @@ function runSimCaseOneByOnefq { dohavecore $2 fi done + rm -rf ../../../sim/case.log + rm -rf ../../sim/case.log } function runPyCaseOneByOne { @@ -158,13 +162,16 @@ function runPyCaseOneByOnefq() { start_time=`date +%s` date +%F\ %T | tee -a pytest-out.log echo -n $case - $line > /dev/null 2>&1 && \ + $line > ../../sim/case.log 2>&1 && \ echo -e "${GREEN} success${NC}" | tee -a pytest-out.log || \ - echo -e "${RED} failed${NC}" | tee -a pytest-out.log + echo -e "${RED} failed${NC}" | tee -a pytest-out.log end_time=`date +%s` out_log=`tail -1 pytest-out.log ` if [[ $out_log =~ 'failed' ]];then cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" ` + echo '=====================log=====================' + cat ../../sim/case.log + rm -rf ../../sim/case.log exit 8 fi echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log @@ -174,6 +181,7 @@ function runPyCaseOneByOnefq() { dohavecore $2 fi done + rm -rf ../../sim/case.log } totalFailed=0 From 0916d24506b4aaf08315045508446bf1ab105cfa Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 22 Mar 2021 14:46:58 +0800 Subject: [PATCH 2/4] fix hosts error --- tests/pytest/cluster/clusterEnvSetup/docker-compose.yml | 2 +- tests/pytest/cluster/clusterEnvSetup/node3.yml | 2 +- tests/pytest/cluster/clusterEnvSetup/node4.yml | 2 +- tests/pytest/cluster/clusterEnvSetup/node5.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml index 9994d671cc..7b47b5e459 100644 --- a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml +++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml @@ -34,7 +34,7 @@ services: - "tdnode7:172.27.0.13" - "tdnode8:172.27.0.14" - "tdnode9:172.27.0.15" - - "tdnode9:172.27.0.16" + - "tdnode10:172.27.0.16" volumes: # bind data directory - type: bind diff --git a/tests/pytest/cluster/clusterEnvSetup/node3.yml b/tests/pytest/cluster/clusterEnvSetup/node3.yml index 431719af0c..56fba49bd7 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node3.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node3.yml @@ -32,7 +32,7 @@ services: - "tdnode7:172.27.0.13" - "tdnode8:172.27.0.14" - "tdnode9:172.27.0.15" - - "tdnode9:172.27.0.16" + - "tdnode10:172.27.0.16" volumes: # bind data directory - type: bind diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml index ecc29bfeeb..2af9fc0293 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node4.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml @@ -32,7 +32,7 @@ services: - "tdnode7:172.27.0.13" - "tdnode8:172.27.0.14" - "tdnode9:172.27.0.15" - - "tdnode9:172.27.0.16" + - "tdnode10:172.27.0.16" volumes: # bind data directory - type: bind diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml index af209ff314..76d5346a14 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node5.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml @@ -32,7 +32,7 @@ services: - "tdnode7:172.27.0.13" - "tdnode8:172.27.0.14" - "tdnode9:172.27.0.15" - - "tdnode9:172.27.0.16" + - "tdnode10:172.27.0.16" volumes: # bind data directory - type: bind From fb7599b7f4ac97ff1b79231ab400987e4709ba8e Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 22 Mar 2021 16:11:49 +0800 Subject: [PATCH 3/4] fix docker compose error --- tests/pytest/cluster/clusterEnvSetup/Dockerfile | 2 ++ tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh | 1 + tests/pytest/cluster/clusterEnvSetup/docker-compose.yml | 2 ++ tests/pytest/cluster/clusterEnvSetup/node3.yml | 2 ++ tests/pytest/cluster/clusterEnvSetup/node4.yml | 2 ++ tests/pytest/cluster/clusterEnvSetup/node5.yml | 2 ++ 6 files changed, 11 insertions(+) diff --git a/tests/pytest/cluster/clusterEnvSetup/Dockerfile b/tests/pytest/cluster/clusterEnvSetup/Dockerfile index c9c4d79be9..437dbc65e6 100644 --- a/tests/pytest/cluster/clusterEnvSetup/Dockerfile +++ b/tests/pytest/cluster/clusterEnvSetup/Dockerfile @@ -28,6 +28,8 @@ RUN ulimit -c unlimited COPY --from=builder /root/bin/taosd /usr/bin COPY --from=builder /root/bin/tarbitrator /usr/bin +COPY --from=builder /root/bin/taosdemo /usr/bin +COPY --from=builder /root/bin/taosdump /usr/bin COPY --from=builder /root/bin/taos /usr/bin COPY --from=builder /root/cfg/taos.cfg /etc/taos/ COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1 diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh index 4cd305d6cd..52ead0675b 100755 --- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -110,6 +110,7 @@ function clusterUp { sed -i "s/td2.0-node3/td2.0-node$i/g" node$i.yml sed -i "s/'tdnode3'/'tdnode$i'/g" node$i.yml sed -i "s#/node3/#/node$i/#g" node$i.yml + sed -i "s#/hostname: tdnode3/#/hostname: tdnode$i/#g" node$i.yml sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" node$i.yml fi docker_run=$docker_run" -f node$i.yml " diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml index 7b47b5e459..d241062a2d 100644 --- a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml +++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml @@ -66,7 +66,9 @@ services: context: . args: - PACKAGE=${PACKAGE} + - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} + - EXTRACTDIR2=${DIR2} - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode2' diff --git a/tests/pytest/cluster/clusterEnvSetup/node3.yml b/tests/pytest/cluster/clusterEnvSetup/node3.yml index 56fba49bd7..18f1b37c1c 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node3.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node3.yml @@ -6,7 +6,9 @@ services: context: . args: - PACKAGE=${PACKAGE} + - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} + - EXTRACTDIR2=${DIR2} - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode3' diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml index 2af9fc0293..f542c22c45 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node4.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml @@ -6,7 +6,9 @@ services: context: . args: - PACKAGE=${PACKAGE} + - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} + - EXTRACTDIR2=${DIR2} - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode4' diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml index 76d5346a14..dd5941ac76 100644 --- a/tests/pytest/cluster/clusterEnvSetup/node5.yml +++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml @@ -6,7 +6,9 @@ services: context: . args: - PACKAGE=${PACKAGE} + - TARBITRATORPKG=${TARBITRATORPKG} - EXTRACTDIR=${DIR} + - EXTRACTDIR2=${DIR2} - DATADIR=${DATADIR} image: 'tdengine:${VERSION}' container_name: 'tdnode5' From d354ce2e55adc07b5415f693350b4a819b718b8b Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 22 Mar 2021 16:18:25 +0800 Subject: [PATCH 4/4] fix --- tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh index 52ead0675b..36fd4197b6 100755 --- a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh +++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh @@ -110,7 +110,7 @@ function clusterUp { sed -i "s/td2.0-node3/td2.0-node$i/g" node$i.yml sed -i "s/'tdnode3'/'tdnode$i'/g" node$i.yml sed -i "s#/node3/#/node$i/#g" node$i.yml - sed -i "s#/hostname: tdnode3/#/hostname: tdnode$i/#g" node$i.yml + sed -i "s#hostname: tdnode3#hostname: tdnode$i#g" node$i.yml sed -i "s#ipv4_address: 172.27.0.9#ipv4_address: 172.27.0.`expr $i + 6`#g" node$i.yml fi docker_run=$docker_run" -f node$i.yml "