diff --git a/README.md b/README.md index 0babfe77763812ae1251e6ac0773091e29724a01..d75680cb22204011b628f45990355982a097ef64 100644 --- a/README.md +++ b/README.md @@ -115,251 +115,6 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo - [RESTful API](https://www.taosdata.com/en/documentation/connector/#RESTful-Connector) - [Node.js](https://www.taosdata.com/en/documentation/connector/#Node.js-Connector) -# How to run the test cases and how to add a new test case? - -### Prepare development environment - -1. sudo apt install - build-essential cmake net-tools python-pip python-setuptools python3-pip - python3-setuptools valgrind psmisc curl - -2. git clone ; cd TDengine - -3. mkdir debug; cd debug; cmake ..; make ; sudo make install - -4. pip install src/connector/python/linux/python2 ; pip3 install - src/connector/python/linux/python3 - -### How to run TSIM test suite - -1. cd \/tests/script - -2. sudo ./test.sh - -### How to run Python test suite - -1. cd \/tests/pytest - -2. ./smoketest.sh \# for smoke test - -3. ./smoketest.sh -g \# for memory leak detection test with valgrind - -4. ./fulltest.sh \# for full test - -> Note1: TDengine daemon's configuration and data files are stored in -> \/sim directory. As a historical design, it's same place with -> TSIM script. So after the TSIM script ran with sudo privilege, the directory -> has been used by TSIM then the python script cannot write it by a normal -> user. You need to remove the directory completely first before running the -> Python test case. We should consider using two different locations to store -> for TSIM and Python script. - -> Note2: if you need to debug crash problem with a core dump, you need -> manually edit smoketest.sh or fulltest.sh to add "ulimit -c unlimited" -> before the script line. Then you can look for the core file in -> \/tests/pytest after the program crash. - -### How to add a new test case - -**1. add a new TSIM test cases:** - -TSIM test cases are now included in the new development branch and can be -added to the TDengine/tests/script/test.sh script based on the manual test -methods necessary to add test cases as described above. - -**2. add a new Python test cases:** - -**2.1 Please refer to \/tests/pytest/insert/basic.py to add a new -test case.** The new test case must implement 3 functions, where self.init() -and self.stop() simply copy the contents of insert/basic.py and the test -logic is implemented in self.run(). You can refer to the code in the util -directory for more information. - -**2.2 Edit smoketest.sh to add the path and filename of the new test case** - -Note: The Python test framework may continue to be improved in the future, -hopefully, to provide more functionality and ease of writing test cases. The -method of writing the test case above does not exclude that it will also be -affected. - -**2.3 What test.py does in detail:** - -test.py is the entry program for test case execution and monitoring. - -test.py has the following functions. - -\-f --file, Specifies the test case file name to be executed --p --path, Specifies deployment path - -\-m --master, Specifies the master server IP for cluster deployment --c--cluster, test cluster function --s--stop, terminates all running nodes - -\-g--valgrind, load valgrind for memory leak detection test - -\-h--help, display help - -**2.4 What util/log.py does in detail:** - -log.py is quite simple, the main thing is that you can print the output in -different colors as needed. The success() should be called for successful -test case execution and the success() will print green text. The exit() will -print red text and exit the program, exit() should be called for test -failure. - -**util/log.py** - -... - -    def info(self, info): - -        printf("%s %s" % (datetime.datetime.now(), info)) - -  - -    def sleep(self, sec): - -        printf("%s sleep %d seconds" % (datetime.datetime.now(), sec)) - -        time.sleep(sec) - -  - -    def debug(self, err): - -        printf("\\033[1;36m%s %s\\033[0m" % (datetime.datetime.now(), err)) - -  - -    def success(self, info): - -        printf("\\033[1;32m%s %s\\033[0m" % (datetime.datetime.now(), info)) - -  - -    def notice(self, err): - -        printf("\\033[1;33m%s %s\\033[0m" % (datetime.datetime.now(), err)) - -  - -    def exit(self, err): - -        printf("\\033[1;31m%s %s\\033[0m" % (datetime.datetime.now(), err)) - -        sys.exit(1) - -  - -    def printNoPrefix(self, info): - -        printf("\\033[1;36m%s\\033[0m" % (info) - -... - -**2.5 What util/sql.py does in detail:** - -SQL.py is mainly used to execute SQL statements to manipulate the database, -and the code is extracted and commented as follows: - -**util/sql.py** - -\# prepare() is mainly used to set up the environment for testing table and -data, and to set up the database db for testing. do not call prepare() if you -need to test the database operation command. - -def prepare(self): - -tdLog.info("prepare database:db") - -self.cursor.execute('reset query cache') - -self.cursor.execute('drop database if exists db') - -self.cursor.execute('create database db') - -self.cursor.execute('use db') - -... - -\# query() is mainly used to execute select statements for normal syntax input - -def query(self, sql): - -... - -\# error() is mainly used to execute the select statement with the wrong syntax -input, the error will be caught as a reasonable behavior, if not caught it will -prove that the test failed - -def error() - -... - -\# checkRows() is used to check the number of returned lines after calling -query(select ...) after calling the query(select ...) to check the number of -rows of returned results. - -def checkRows(self, expectRows): - -... - -\# checkData() is used to check the returned result data after calling -query(select ...) after the query(select ...) is called, failure to meet -expectation is - -def checkData(self, row, col, data): - -... - -\# getData() returns the result data after calling query(select ...) to return -the resulting data after calling query(select ...) - -def getData(self, row, col): - -... - -\# execute() used to execute sql and return the number of affected rows - -def execute(self, sql): - -... - -\# executeTimes() Multiple executions of the same sql statement - -def executeTimes(self, sql, times): - -... - -\# CheckAffectedRows() Check if the number of affected rows is as expected - -def checkAffectedRows(self, expectAffectedRows): - -... - -> Note: Both Python2 and Python3 are currently supported by the Python test -> case. Since Python2 is no longer officially supported by January 1, 2020, it -> is recommended that subsequent test case development be guaranteed to run -> correctly on Python3. For Python2, please consider being compatible if -> appropriate without additional -> burden.   - -### CI Covenant submission adoption principle. - -- Every commit / PR compilation must pass. Currently, the warning is treated - as an error, so the warning must also be resolved. - -- Test cases that already exist must pass. - -- Because CI is very important to support build and automatically test - procedure, it is necessary to manually test the test case before adding it - and do as many iterations as possible to ensure that the test case provides - stable and reliable test results when added. - -> Note: In the future, according to the requirements and test development -> progress will add stress testing, performance testing, code style, -> and other features based on functional testing. - ### Third Party Connectors The TDengine community has also kindly built some of their own connectors! Follow the links below to find the source code for them. @@ -367,6 +122,10 @@ The TDengine community has also kindly built some of their own connectors! Follo - [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust) - [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos) +# How to run the test cases and how to add a new test case? + TDengine's test framework and all test cases are fully open source. + Please refer to [this document](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case. + # TDengine Roadmap - Support event-driven stream computing - Support user defined functions diff --git a/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md b/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md new file mode 100644 index 0000000000000000000000000000000000000000..7c42d47d1b9c95a863539e3dbe1f4b94abf6c753 --- /dev/null +++ b/tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md @@ -0,0 +1,235 @@ +### Prepare development environment + +1. sudo apt install + build-essential cmake net-tools python-pip python-setuptools python3-pip + python3-setuptools valgrind psmisc curl + +2. git clone ; cd TDengine + +3. mkdir debug; cd debug; cmake ..; make ; sudo make install + +4. pip install src/connector/python/linux/python2 ; pip3 install + src/connector/python/linux/python3 + +### How to run Python test suite + +1. cd \/tests/pytest + +2. ./smoketest.sh \# for smoke test + +3. ./smoketest.sh -g \# for memory leak detection test with valgrind + +4. ./fulltest.sh \# for full test + +> Note1: TDengine daemon's configuration and data files are stored in +> \/sim directory. As a historical design, it's same place with +> TSIM script. So after the TSIM script ran with sudo privilege, the directory +> has been used by TSIM then the python script cannot write it by a normal +> user. You need to remove the directory completely first before running the +> Python test case. We should consider using two different locations to store +> for TSIM and Python script. + +> Note2: if you need to debug crash problem with a core dump, you need +> manually edit smoketest.sh or fulltest.sh to add "ulimit -c unlimited" +> before the script line. Then you can look for the core file in +> \/tests/pytest after the program crash. + + +### How to add a new test case + +**1. TSIM test cases:** + +TSIM was the testing framework has been used internally. Now it still be used to run the test cases we develop in the past as a legacy system. We are turning to use Python to develop new test case and are abandoning TSIM gradually. + +**2. Python test cases:** + +**2.1 Please refer to \/tests/pytest/insert/basic.py to add a new +test case.** The new test case must implement 3 functions, where self.init() +and self.stop() simply copy the contents of insert/basic.py and the test +logic is implemented in self.run(). You can refer to the code in the util +directory for more information. + +**2.2 Edit smoketest.sh to add the path and filename of the new test case** + +Note: The Python test framework may continue to be improved in the future, +hopefully, to provide more functionality and ease of writing test cases. The +method of writing the test case above does not exclude that it will also be +affected. + +**2.3 What test.py does in detail:** + +test.py is the entry program for test case execution and monitoring. + +test.py has the following functions. + +\-f --file, Specifies the test case file name to be executed +-p --path, Specifies deployment path + +\-m --master, Specifies the master server IP for cluster deployment +-c--cluster, test cluster function +-s--stop, terminates all running nodes + +\-g--valgrind, load valgrind for memory leak detection test + +\-h--help, display help + +**2.4 What util/log.py does in detail:** + +log.py is quite simple, the main thing is that you can print the output in +different colors as needed. The success() should be called for successful +test case execution and the success() will print green text. The exit() will +print red text and exit the program, exit() should be called for test +failure. + +**util/log.py** + +... + +    def info(self, info): + +        printf("%s %s" % (datetime.datetime.now(), info)) + +  + +    def sleep(self, sec): + +        printf("%s sleep %d seconds" % (datetime.datetime.now(), sec)) + +        time.sleep(sec) + +  + +    def debug(self, err): + +        printf("\\033[1;36m%s %s\\033[0m" % (datetime.datetime.now(), err)) + +  + +    def success(self, info): + +        printf("\\033[1;32m%s %s\\033[0m" % (datetime.datetime.now(), info)) + +  + +    def notice(self, err): + +        printf("\\033[1;33m%s %s\\033[0m" % (datetime.datetime.now(), err)) + +  + +    def exit(self, err): + +        printf("\\033[1;31m%s %s\\033[0m" % (datetime.datetime.now(), err)) + +        sys.exit(1) + +  + +    def printNoPrefix(self, info): + +        printf("\\033[1;36m%s\\033[0m" % (info) + +... + +**2.5 What util/sql.py does in detail:** + +SQL.py is mainly used to execute SQL statements to manipulate the database, +and the code is extracted and commented as follows: + +**util/sql.py** + +\# prepare() is mainly used to set up the environment for testing table and +data, and to set up the database db for testing. do not call prepare() if you +need to test the database operation command. + +def prepare(self): + +tdLog.info("prepare database:db") + +self.cursor.execute('reset query cache') + +self.cursor.execute('drop database if exists db') + +self.cursor.execute('create database db') + +self.cursor.execute('use db') + +... + +\# query() is mainly used to execute select statements for normal syntax input + +def query(self, sql): + +... + +\# error() is mainly used to execute the select statement with the wrong syntax +input, the error will be caught as a reasonable behavior, if not caught it will +prove that the test failed + +def error() + +... + +\# checkRows() is used to check the number of returned lines after calling +query(select ...) after calling the query(select ...) to check the number of +rows of returned results. + +def checkRows(self, expectRows): + +... + +\# checkData() is used to check the returned result data after calling +query(select ...) after the query(select ...) is called, failure to meet +expectation is + +def checkData(self, row, col, data): + +... + +\# getData() returns the result data after calling query(select ...) to return +the resulting data after calling query(select ...) + +def getData(self, row, col): + +... + +\# execute() used to execute sql and return the number of affected rows + +def execute(self, sql): + +... + +\# executeTimes() Multiple executions of the same sql statement + +def executeTimes(self, sql, times): + +... + +\# CheckAffectedRows() Check if the number of affected rows is as expected + +def checkAffectedRows(self, expectAffectedRows): + +... + +> Note: Both Python2 and Python3 are currently supported by the Python test +> case. Since Python2 is no longer officially supported by January 1, 2020, it +> is recommended that subsequent test case development be guaranteed to run +> correctly on Python3. For Python2, please consider being compatible if +> appropriate without additional +> burden.   + +### CI submission adoption principle. + +- Every commit / PR compilation must pass. Currently, the warning is treated + as an error, so the warning must also be resolved. + +- Test cases that already exist must pass. + +- Because CI is very important to support build and automatically test + procedure, it is necessary to manually test the test case before adding it + and do as many iterations as possible to ensure that the test case provides + stable and reliable test results when added. + +> Note: In the future, according to the requirements and test development +> progress will add stress testing, performance testing, code style, +> and other features based on functional testing. diff --git a/tests/script/general/stable/dnode3.sim b/tests/script/general/stable/dnode3.sim new file mode 100644 index 0000000000000000000000000000000000000000..38d05a924b819acb5551924c613f8b827a322b6e --- /dev/null +++ b/tests/script/general/stable/dnode3.sim @@ -0,0 +1,223 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 +system sh/cfg.sh -n dnode3 -c walLevel -v 0 +system sh/cfg.sh -n dnode4 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 +system sh/exec.sh -n dnode1 -s start + +sql connect + +sql create dnode $hostname2 +sql create dnode $hostname3 +sql create dnode $hostname4 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +$x = 0 +createDnode: + $x = $x + 1 + sleep 1000 + if $x == 20 then + return -1 + endi +sql show dnodes; +if $data4_2 == offline then + goto createDnode +endi +if $data4_3 == offline then + goto createDnode +endi +if $data4_4 == offline then + goto createDnode +endi + +print ======================== dnode1 start + +$dbPrefix = r3v3_db +$tbPrefix = r3v3_tb +$mtPrefix = r3v3_mt +$tbNum = 10 +$rowNum = 20 +$totalNum = 200 + +print =============== step1 +$i = 0 +$db = $dbPrefix . $i +$mt = $mtPrefix . $i + +sql create database $db maxTables 4 +sql use $db +sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using $mt tags( $i ) + + $x = 0 + while $x < $rowNum + $val = $x * 60000 + $ms = 1519833600000 + $val + sql insert into $tb values ($ms , $x ) + $x = $x + 1 + endw + + $i = $i + 1 +endw + +sql show vgroups +print vgroups ==> $rows +if $rows != 3 then + return -1 +endi + +sleep 100 + +print =============== step2 +$i = 1 +$tb = $tbPrefix . $i + +sql select count(*) from $tb +print ===> $data00 +if $data00 != $rowNum then + return -1 +endi + +sql select count(tbcol) from $tb +print ===> $data00 +if $data00 != $rowNum then + return -1 +endi + +print =============== step3 +sql select count(tbcol) from $tb where ts <= 1519833840000 +print ===> $data00 +if $data00 != 5 then + return -1 +endi + +print =============== step4 +sql select count(tbcol) as b from $tb +print ===> $data00 +if $data00 != $rowNum then + return -1 +endi + +print =============== step5 +sql select count(tbcol) as b from $tb interval(1m) +print ===> $data01 +if $data01 != 1 then + return -1 +endi + +sql select count(tbcol) as b from $tb interval(1d) +print ===> $data01 +if $data01 != $rowNum then + return -1 +endi + +print =============== step6 +sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +print ===> $data01 +if $data01 != 1 then + return -1 +endi +if $rows != 5 then + return -1 +endi + +print =============== step7 +print select count(*) from $mt +sql select count(*) from $mt +print ===> $data00 +if $data00 != $totalNum then + return -1 +endi + +sql select count(tbcol) from $mt +print ===> $data00 +if $data00 != $totalNum then + return -1 +endi + +print =============== step8 +sql select count(tbcol) as c from $mt where ts <= 1519833840000 +print ===> $data00 +if $data00 != 50 then + return -1 +endi + +sql select count(tbcol) as c from $mt where tgcol < 5 +print ===> $data00 +if $data00 != 100 then + return -1 +endi + +sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000 +print ===> $data00 +if $data00 != 25 then + return -1 +endi + +print =============== step9 +sql select count(tbcol) as b from $mt interval(1m) +print ===> $data01 +if $data01 != 10 then + return -1 +endi + +sql select count(tbcol) as b from $mt interval(1d) +print ===> $data01 +if $data01 != 200 then + return -1 +endi + +print =============== step10 +sql select count(tbcol) as b from $mt group by tgcol +print ===> $data00 +if $data00 != $rowNum then + return -1 +endi + +if $rows != $tbNum then + return -1 +endi + +print =============== step11 +sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol +print ===> $data01 +if $data01 != 1 then + return -1 +endi +if $rows != 50 then + return -1 +endi + +print =============== clear +sql drop database $db +sql show databases +if $rows != 0 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/stable/testSuite.sim b/tests/script/general/stable/testSuite.sim index a3696c8706e6c1913d06df31866f9ea0a37620b0..e786ac9ca4d1b3e8aea7cec9625fe2fd1481377b 100644 --- a/tests/script/general/stable/testSuite.sim +++ b/tests/script/general/stable/testSuite.sim @@ -1,4 +1,5 @@ run general/stable/disk.sim +run general/stable/dnode3.sim run general/stable/metrics.sim run general/stable/values.sim run general/stable/vnode3.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index b86113eb51ec24daf37b7ef5cdcdf2dd84710bde..c59ea987dec8a62f7c60d8ad64d8eb01dd99cae5 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -85,10 +85,10 @@ cd ../../../debug; make ./test.sh -f general/import/basic.sim ./test.sh -f general/import/commit.sim ./test.sh -f general/import/large.sim -#hongze ./test.sh -f general/import/replica1.sim +#liao ./test.sh -f general/import/replica1.sim ./test.sh -f general/insert/basic.sim -#hongze ./test.sh -f general/insert/insert_drop.sim +#liao ./test.sh -f general/insert/insert_drop.sim ./test.sh -f general/insert/query_block1_memory.sim ./test.sh -f general/insert/query_block2_memory.sim ./test.sh -f general/insert/query_block1_file.sim @@ -150,6 +150,7 @@ cd ../../../debug; make #./test.sh -f general/parser/bug.sim ./test.sh -f general/stable/disk.sim +#./test.sh -f general/stable/dnode3.sim ./test.sh -f general/stable/metrics.sim ./test.sh -f general/stable/values.sim ./test.sh -f general/stable/vnode3.sim @@ -251,16 +252,16 @@ cd ../../../debug; make ./test.sh -u -f unique/column/replica3.sim -#hongze ./test.sh -u -f unique/db/commit.sim +#hongze crash ./test.sh -u -f unique/db/commit.sim ./test.sh -u -f unique/db/delete.sim -#./test.sh -u -f unique/db/delete_part.sim -##./test.sh -u -f unique/db/replica_add12.sim -##./test.sh -u -f unique/db/replica_add13.sim -##./test.sh -u -f unique/db/replica_add23.sim -##./test.sh -u -f unique/db/replica_reduce21.sim -##./test.sh -u -f unique/db/replica_reduce32.sim -##./test.sh -u -f unique/db/replica_reduce31.sim -##./test.sh -u -f unique/db/replica_part.sim +./test.sh -u -f unique/db/delete_part.sim +./test.sh -u -f unique/db/replica_add12.sim +#hongze crash ./test.sh -u -f unique/db/replica_add13.sim +#hongze crash ./test.sh -u -f unique/db/replica_add23.sim +#hongze crash ./test.sh -u -f unique/db/replica_reduce21.sim +./test.sh -u -f unique/db/replica_reduce32.sim +#hongze crash /test.sh -u -f unique/db/replica_reduce31.sim +./test.sh -u -f unique/db/replica_part.sim ##./test.sh -u -f unique/dnode/balance1.sim ##./test.sh -u -f unique/dnode/balance2.sim @@ -278,14 +279,14 @@ cd ../../../debug; make #./test.sh -u -f unique/import/replica2.sim #./test.sh -u -f unique/import/replica3.sim -#./test.sh -u -f unique/metrics/balance_replica1.sim -#./test.sh -u -f unique/metrics/dnode2_stop.sim -#./test.sh -u -f unique/metrics/dnode2.sim -#./test.sh -u -f unique/metrics/dnode3.sim -#./test.sh -u -f unique/metrics/replica2_dnode4.sim -#./test.sh -u -f unique/metrics/replica2_vnode3.sim -#./test.sh -u -f unique/metrics/replica3_dnode6.sim -#./test.sh -u -f unique/metrics/replica3_vnode3.sim +#./test.sh -u -f unique/stable/balance_replica1.sim +#./test.sh -u -f unique/stable/dnode2_stop.sim +#./test.sh -u -f unique/stable/dnode2.sim +#./test.sh -u -f unique/stable/dnode3.sim +#./test.sh -u -f unique/stable/replica2_dnode4.sim +#./test.sh -u -f unique/stable/replica2_vnode3.sim +#./test.sh -u -f unique/stable/replica3_dnode6.sim +#./test.sh -u -f unique/stable/replica3_vnode3.sim ./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt23.sim @@ -296,13 +297,9 @@ cd ../../../debug; make ./test.sh -u -f unique/mnode/mgmt34.sim ./test.sh -u -f unique/mnode/mgmtr2.sim -##./test.sh -u -f unique/table/delete_part.sim - -#./test.sh -u -f unique/vnode/commit.sim -#./test.sh -u -f unique/vnode/many.sim -#./test.sh -u -f unique/vnode/replica2_basic.sim +./test.sh -u -f unique/vnode/many.sim ./test.sh -u -f unique/vnode/replica2_basic2.sim -#./test.sh -u -f unique/vnode/replica2_repeat.sim -#hongze ./test.sh -u -f unique/vnode/replica3_basic.sim -#./test.sh -u -f unique/vnode/replica3_repeat.sim -#./test.sh -u -f unique/vnode/replica3_vgroup.sim +./test.sh -u -f unique/vnode/replica2_repeat.sim +./test.sh -u -f unique/vnode/replica3_basic.sim +./test.sh -u -f unique/vnode/replica3_repeat.sim +./test.sh -u -f unique/vnode/replica3_vgroup.sim diff --git a/tests/script/unique/db/delete.sim b/tests/script/unique/db/delete.sim index 0ae6a3c13ce9fe8805dacc6bfbf90e36b5c692f0..5688333d20fc8867de16dbe5cc4705183d12d8df 100644 --- a/tests/script/unique/db/delete.sim +++ b/tests/script/unique/db/delete.sim @@ -34,13 +34,14 @@ while $i < 2000 $i = $i + 1 endw +sleep 2500 + sql show db.vgroups if $rows != 2 then return -1 endi print ======== step2 -sleep 1000 sql drop database db sql show databases if $rows != 0 then diff --git a/tests/script/unique/db/delete_part.sim b/tests/script/unique/db/delete_part.sim index 7cf326e1919859a4aa1a88f707bff996af9e0b8b..179d729d8dae2b7b0a8bf890fdfb43e5be76a05a 100644 --- a/tests/script/unique/db/delete_part.sim +++ b/tests/script/unique/db/delete_part.sim @@ -45,27 +45,126 @@ begin: sql create database $db sql use $db - $x = 0 - while $x < 32 - $tb = tb . $x - sql create table $tb (ts timestamp, i int) - sql insert into $tb values(now, $x ) - $x = $x + 1 - endw + sql create table t11 (ts timestamp, i int) + sql insert into t11 values(now, 1 ) + sql create table t12 (ts timestamp, i int) + sql insert into t12 values(now, 1 ) + sql create table t13 (ts timestamp, i int) + sql insert into t13 values(now, 1 ) + sql create table t14 (ts timestamp, i int) + sql insert into t14 values(now, 1 ) + sleep 1200 + + sql create table t21 (ts timestamp, i int) + sql insert into t21 values(now, 1 ) + sql create table t22 (ts timestamp, i int) + sql insert into t22 values(now, 1 ) + sql create table t23 (ts timestamp, i int) + sql insert into t23 values(now, 1 ) + sql create table t24 (ts timestamp, i int) + sql insert into t24 values(now, 1 ) + sleep 1200 + + sql create table t31 (ts timestamp, i int) + sql insert into t31 values(now, 1 ) + sql create table t32 (ts timestamp, i int) + sql insert into t32 values(now, 1 ) + sql create table t33 (ts timestamp, i int) + sql insert into t33 values(now, 1 ) + sql create table t34 (ts timestamp, i int) + sql insert into t34 values(now, 1 ) + sleep 1200 + + sql create table t41 (ts timestamp, i int) + sql insert into t41 values(now, 1 ) + sql create table t42 (ts timestamp, i int) + sql insert into t42 values(now, 1 ) + sql create table t43 (ts timestamp, i int) + sql insert into t43 values(now, 1 ) + sql create table t44 (ts timestamp, i int) + sql insert into t44 values(now, 1 ) + sleep 1200 + + sql create table t51 (ts timestamp, i int) + sql insert into t51 values(now, 1 ) + sql create table t52 (ts timestamp, i int) + sql insert into t52 values(now, 1 ) + sql create table t53 (ts timestamp, i int) + sql insert into t53 values(now, 1 ) + sql create table t54 (ts timestamp, i int) + sql insert into t54 values(now, 1 ) + sleep 1200 + + sql create table t61 (ts timestamp, i int) + sql insert into t61 values(now, 1 ) + sql create table t62 (ts timestamp, i int) + sql insert into t62 values(now, 1 ) + sql create table t63 (ts timestamp, i int) + sql insert into t63 values(now, 1 ) + sql create table t64 (ts timestamp, i int) + sql insert into t64 values(now, 1 ) + sleep 1200 + + sql create table t71 (ts timestamp, i int) + sql insert into t71 values(now, 1 ) + sql create table t72 (ts timestamp, i int) + sql insert into t72 values(now, 1 ) + sql create table t73 (ts timestamp, i int) + sql insert into t73 values(now, 1 ) + sql create table t74 (ts timestamp, i int) + sql insert into t74 values(now, 1 ) + sleep 1200 + + sql create table t81 (ts timestamp, i int) + sql insert into t81 values(now, 1 ) + sql create table t82 (ts timestamp, i int) + sql insert into t82 values(now, 1 ) + sql create table t83 (ts timestamp, i int) + sql insert into t83 values(now, 1 ) + sql create table t84 (ts timestamp, i int) + sql insert into t84 values(now, 1 ) + sleep 1200 + + sql show dnodes + print dnode1 openVnodes $data2_1 + print dnode2 openVnodes $data2_2 + if $data2_1 != 4 then + return -1 + endi + if $data2_2 != 4 then + return -1 + endi print ======== step2 $loop + system sh/exec_up.sh -n dnode2 -s stop sleep 1000 + print ==> drop database $db sql drop database $db - print ======== step3 $loop - sleep 3000 + sleep 2000 system sh/exec_up.sh -n dnode2 -s start - sleep 5000 + sleep 15000 + + sql show dnodes + print dnode1 openVnodes $data2_1 $data4_1 + print dnode2 openVnodes $data2_2 $data4_2 + if $data2_1 != 0 then + return -1 + endi + if $data2_2 != 0 then + return -1 + endi + if $data4_1 != ready then + return -1 + endi + if $data4_2 != ready then + return -1 + endi print ===> test times : $loop - if $loop > 5 then + if $loop > 3 then return 0 endi diff --git a/tests/script/unique/db/replica_part.sim b/tests/script/unique/db/replica_part.sim index f0ffb8901526f59ae30f5bd43e89010b2bdf454f..76e3eaabbe1ad7cfa94177186df6e66327f248a7 100644 --- a/tests/script/unique/db/replica_part.sim +++ b/tests/script/unique/db/replica_part.sim @@ -7,9 +7,9 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/cfg.sh -n dnode2 -c wallevel -v 2 system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 -system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 -system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 +system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 +system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 +system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index ad044e3984486d851391c96622a5d31e18c6e910..4e126c4e6098bcc1fda0a47929197569e4a7b5c7 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -204,7 +204,7 @@ system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 134 print $system_content -if $system_content != @{"failed":1,"success":1}@ then +if $system_content != @{"failed":0,"success":2}@ then return -1 endi diff --git a/tests/script/unique/metrics/balance_replica1.sim b/tests/script/unique/stable/balance_replica1.sim similarity index 95% rename from tests/script/unique/metrics/balance_replica1.sim rename to tests/script/unique/stable/balance_replica1.sim index 52bf558faa46395682e4bad34073f9e3f8fce286..8cf41319a020d201af62d4a775737aac679f9bba 100644 --- a/tests/script/unique/metrics/balance_replica1.sim +++ b/tests/script/unique/stable/balance_replica1.sim @@ -1,7 +1,4 @@ system sh/stop_dnodes.sh - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 @@ -26,7 +23,7 @@ $totalNum = 200 print ============== step1 print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect $i = 0 @@ -81,7 +78,7 @@ if $dnode2Vnodes != NULL then endi print =============== step3 start dnode2 sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start sleep 8000 $x = 0 diff --git a/tests/script/unique/metrics/dnode2.sim b/tests/script/unique/stable/dnode2.sim similarity index 96% rename from tests/script/unique/metrics/dnode2.sim rename to tests/script/unique/stable/dnode2.sim index cd76b39ba0dfaa49495c513bfcc2e7a748fd1ab1..2d894c6542f9ff710680641b82a8a5464285d745 100644 --- a/tests/script/unique/metrics/dnode2.sim +++ b/tests/script/unique/stable/dnode2.sim @@ -1,7 +1,4 @@ system sh/stop_dnodes.sh - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c walLevel -v 0 @@ -10,12 +7,12 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start $x = 0 createDnode: @@ -25,7 +22,7 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi diff --git a/tests/script/unique/metrics/dnode2_stop.sim b/tests/script/unique/stable/dnode2_stop.sim similarity index 92% rename from tests/script/unique/metrics/dnode2_stop.sim rename to tests/script/unique/stable/dnode2_stop.sim index 996482d11ebcfda55a1734bf233bd6e21ae8a44c..55ad5fcf094bb35cd399762bbce23e3b0b390d4b 100644 --- a/tests/script/unique/metrics/dnode2_stop.sim +++ b/tests/script/unique/stable/dnode2_stop.sim @@ -1,7 +1,4 @@ system sh/stop_dnodes.sh - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c walLevel -v 0 @@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start $x = 0 createDnode: @@ -24,7 +21,7 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi @@ -76,7 +73,7 @@ endi sleep 100 -system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT print =============== step2 sql select count(*) from $mt -x step2 @@ -87,7 +84,7 @@ sql select count(tbcol) from $mt -x step21 return -1 step21: -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start sleep 10000 print =============== step3 diff --git a/tests/script/unique/metrics/dnode3.sim b/tests/script/unique/stable/dnode3.sim similarity index 94% rename from tests/script/unique/metrics/dnode3.sim rename to tests/script/unique/stable/dnode3.sim index 3a5419dff4e579507d9b7eebb72d5bc6921a5c2d..384129a94c9b66f3e9424ed6161a0db33ef8adac 100644 --- a/tests/script/unique/metrics/dnode3.sim +++ b/tests/script/unique/stable/dnode3.sim @@ -1,8 +1,4 @@ system sh/stop_dnodes.sh - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 @@ -15,14 +11,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode3 -s start $x = 0 createDnode: @@ -32,10 +28,10 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi -if $data4_192.168.0.3 == offline then +if $data4_3 == offline then goto createDnode endi diff --git a/tests/script/unique/metrics/replica2_dnode4.sim b/tests/script/unique/stable/replica2_dnode4.sim similarity index 93% rename from tests/script/unique/metrics/replica2_dnode4.sim rename to tests/script/unique/stable/replica2_dnode4.sim index bedc895dd180dcb14a0adf34a91361ad01b0c723..f204e059491b63e79008a9d54b2e1934b9f28072 100644 --- a/tests/script/unique/metrics/replica2_dnode4.sim +++ b/tests/script/unique/stable/replica2_dnode4.sim @@ -1,9 +1,4 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 @@ -20,16 +15,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start +system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode4 -s start $x = 0 createDnode: @@ -39,13 +34,13 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi -if $data4_192.168.0.3 == offline then +if $data4_3 == offline then goto createDnode endi -if $data4_192.168.0.4 == offline then +if $data4_4 == offline then goto createDnode endi diff --git a/tests/script/unique/metrics/replica2_vnode3.sim b/tests/script/unique/stable/replica2_vnode3.sim similarity index 96% rename from tests/script/unique/metrics/replica2_vnode3.sim rename to tests/script/unique/stable/replica2_vnode3.sim index 9a1d3477be9344d8451eec158e32209ca1b7b40d..238e2e4aee36c3311cb57a6c16e270db1a9e8195 100644 --- a/tests/script/unique/metrics/replica2_vnode3.sim +++ b/tests/script/unique/stable/replica2_vnode3.sim @@ -1,7 +1,4 @@ system sh/stop_dnodes.sh - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c walLevel -v 0 @@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start $x = 0 createDnode: @@ -24,7 +21,7 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi diff --git a/tests/script/unique/metrics/replica3_dnode6.sim b/tests/script/unique/stable/replica3_dnode6.sim similarity index 91% rename from tests/script/unique/metrics/replica3_dnode6.sim rename to tests/script/unique/stable/replica3_dnode6.sim index 135e594cdcfdc5f9e85cab1aeb531f6349eafa81..1c8a8ae10ecb817fef4a1f72518caa30c4da197d 100644 --- a/tests/script/unique/metrics/replica3_dnode6.sim +++ b/tests/script/unique/stable/replica3_dnode6.sim @@ -1,12 +1,4 @@ system sh/stop_dnodes.sh - - - - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 @@ -35,7 +27,7 @@ system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 @@ -43,11 +35,11 @@ sql create dnode $hostname3 sql create dnode $hostname4 sql create dnode $hostname5 sql create dnode $hostname6 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -system sh/exec.sh -n dnode5 -s start -system sh/exec.sh -n dnode6 -s start +system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode4 -s start +system sh/exec_up.sh -n dnode5 -s start +system sh/exec_up.sh -n dnode6 -s start $x = 0 createDnode: @@ -57,19 +49,19 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi -if $data4_192.168.0.3 == offline then +if $data4_3 == offline then goto createDnode endi -if $data4_192.168.0.4 == offline then +if $data4_4 == offline then goto createDnode endi -if $data4_192.168.0.5 == offline then +if $data4_5 == offline then goto createDnode endi -if $data4_192.168.0.6 == offline then +if $data4_6 == offline then goto createDnode endi diff --git a/tests/script/unique/metrics/replica3_vnode3.sim b/tests/script/unique/stable/replica3_vnode3.sim similarity index 93% rename from tests/script/unique/metrics/replica3_vnode3.sim rename to tests/script/unique/stable/replica3_vnode3.sim index ca147c1ef5af4b74462267a6554589e8da01f24c..75870af4c43de82dc99ba375a0035040bf249d9e 100644 --- a/tests/script/unique/metrics/replica3_vnode3.sim +++ b/tests/script/unique/stable/replica3_vnode3.sim @@ -1,9 +1,5 @@ system sh/stop_dnodes.sh - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 @@ -20,16 +16,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start +system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode4 -s start $x = 0 createDnode: $x = $x + 1 @@ -38,13 +34,13 @@ createDnode: return -1 endi sql show dnodes; -if $data4_192.168.0.2 == offline then +if $data4_2 == offline then goto createDnode endi -if $data4_192.168.0.3 == offline then +if $data4_3 == offline then goto createDnode endi -if $data4_192.168.0.4 == offline then +if $data4_4 == offline then goto createDnode endi @@ -144,6 +140,7 @@ if $rows != 5 then endi print =============== step7 +print select count(*) from $mt sql select count(*) from $mt print ===> $data00 if $data00 != $totalNum then @@ -208,7 +205,7 @@ endi if $rows != 50 then return -1 endi -return + print =============== clear sql drop database $db sql show databases diff --git a/tests/script/unique/metrics/testSuite.sim b/tests/script/unique/stable/testSuite.sim similarity index 100% rename from tests/script/unique/metrics/testSuite.sim rename to tests/script/unique/stable/testSuite.sim diff --git a/tests/script/unique/table/back_insert.sim b/tests/script/unique/table/back_insert.sim deleted file mode 100644 index 43831cca95b49218719c5172c3d2d96ad3500896..0000000000000000000000000000000000000000 --- a/tests/script/unique/table/back_insert.sim +++ /dev/null @@ -1,7 +0,0 @@ -sql connect -$x = 1 -begin: - sql insert into db.tb values(now, $x ) -x begin - #print ===> insert successed $x - $x = $x + 1 -goto begin \ No newline at end of file diff --git a/tests/script/unique/table/delete_part.sim b/tests/script/unique/table/delete_part.sim deleted file mode 100644 index 04cb03598ccd207b8790d3262f8271ecff743812..0000000000000000000000000000000000000000 --- a/tests/script/unique/table/delete_part.sim +++ /dev/null @@ -1,85 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 -system sh/cfg.sh -n dnode3 -c walLevel -v 0 -system sh/cfg.sh -n dnode4 -c walLevel -v 0 - -system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1 - -system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -sql create database dpdb -sql use dpdb - -$loop = 0 -begin: - - print ======== step1 - - $x = 0 - while $x < 16 - $tb = tb . $x - sql create table $tb (ts timestamp, i int) - sql insert into $tb values(now, $x ) - $x = $x + 1 - endw - - print ======== step2 - system sh/exec.sh -n dnode2 -s stop - $x = 0 - while $x < 16 - $tb = tb . $x - sql drop table $tb - $x = $x + 1 - endw - - print ======== step3 - sleep 2000 - system sh/exec.sh -n dnode2 -s start - sleep 3000 - - print ===> test times : $loop - if $loop > 20 then - return 0 - endi - - $loop = $loop + 1 - -goto begin - -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -system sh/exec_up.sh -n dnode4 -s stop -x SIGINT -system sh/exec_up.sh -n dnode5 -s stop -x SIGINT -system sh/exec_up.sh -n dnode6 -s stop -x SIGINT -system sh/exec_up.sh -n dnode7 -s stop -x SIGINT -system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/table/testSuite.sim b/tests/script/unique/table/testSuite.sim deleted file mode 100644 index e0c0a1f2fabdaa079deb8b8db08db2095d1148fd..0000000000000000000000000000000000000000 --- a/tests/script/unique/table/testSuite.sim +++ /dev/null @@ -1 +0,0 @@ -run unique/table/delete_part.sim diff --git a/tests/script/unique/testSuite.sim b/tests/script/unique/testSuite.sim deleted file mode 100644 index 374f9b7965ae134bd1acf08449d53a3e918a9e7e..0000000000000000000000000000000000000000 --- a/tests/script/unique/testSuite.sim +++ /dev/null @@ -1,3 +0,0 @@ -################################# -run unique/mnode/testSuite.sim -################################## diff --git a/tests/script/unique/vnode/commit.sim b/tests/script/unique/vnode/commit.sim deleted file mode 100644 index 29c9f72335fc01f156045396452e57f03ca3b590..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/commit.sim +++ /dev/null @@ -1,158 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 -system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 -system sh/exec_up.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -system sh/exec_up.sh -n dnode2 -s start -sleep 3000 - -print =================== step 1 create db -sql create database c2db replica 2 days 10 keep 50 -sql use c2db -sql create table tb (ts timestamp, speed int) -sql insert into tb values(now, 0) - -print =================== step2 sleep 2000 and kill dnode2(SIGINT) -sleep 2000 -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -sleep 1000 - -print =================== step3 insert into dnode1 - -$x = 1 -while $x < 100 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 240 -while $x < 400 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 480 -while $x < 700 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 720 -while $x < 809 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 960 -while $x < 1043 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 1200 -while $x < 1244 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 1440 -while $x < 1677 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -$x = 1680 -while $x < 1683 - $time = $x . m - sql insert into tb values (now + $time , $x ) - $x = $x + 1 -endw - -print =================== step4 -sql select count(*) from tb -print select count(*) from tb ==> $data00 (expect 936) -if $data00 != 936 then - return -1 -endi -sql select * from tb order by ts desc -print select * from tb ==> $data00 $data01 $rows -if $data01 != 1682 then - return -1 -endi -if $rows != 936 then - return -1 -endi - -print =================== step5 sleep kill dnode1(SIGINT) then start dnode1 -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -sleep 5000 -system sh/exec_up.sh -n dnode1 -s start - -sleep 3000 -print =================== step6 start dnode2 and sleep 10000 (wait sync complete) -system sh/exec_up.sh -n dnode2 -s start -sleep 12000 - -print =================== step7 -sql_error insert into tb values(now + 1000h, 100) -sql select count(*) from tb order by ts desc -print select count(*) from tb ==> $data00 (expect <= 936) -if $data00 != 936 then - return -1 -endi -$remainRows = $data00 - -sql select * from tb order by ts desc -print select * from tb ==> $data00 $data01 $data10 $data11 $rows - -if $data11 != 1681 then - return -1 -endi -if $rows != $remainRows then - return -1 -endi - -print =================== step8 kill dnode1(SIGINT) and query -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -sleep 2000 - -print =================== step9 -sql select count(*) from tb order by ts desc -print select count(*) from tb ==> $data00 (expect == $remainRows ) -if $data00 > $remainRows then - return -1 -endi -if $data00 <= 0 then - return -1 -endi - -$remainRows = $data00 -sql select * from tb order by ts desc -print select * from tb ==> $data00 $data01 $rows - -if $rows != $remainRows then - return -1 -endi - -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -system sh/exec_up.sh -n dnode4 -s stop -x SIGINT -system sh/exec_up.sh -n dnode5 -s stop -x SIGINT -system sh/exec_up.sh -n dnode6 -s stop -x SIGINT -system sh/exec_up.sh -n dnode7 -s stop -x SIGINT -system sh/exec_up.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim index 0504207c2ed57ca6735a582c35740f68bc3df898..bb3e8813bd7666fa9fda2bb8495cf28a3648fe22 100644 --- a/tests/script/unique/vnode/many.sim +++ b/tests/script/unique/vnode/many.sim @@ -53,27 +53,27 @@ sql select count(*) from db4.tb4 $lastRows4 = $rows print ======== step2 -run_back cluster/vnode/back_insert_many.sim +run_back unique/vnode/back_insert_many.sim sleep 5000 print ======== step3 system sh/exec_up.sh -n dnode2 -s stop -sleep 10000 +sleep 5000 $x = 0 loop: print ======== step4 system sh/exec_up.sh -n dnode2 -s start -sleep 10000 +sleep 5000 system sh/exec_up.sh -n dnode3 -s stop -sleep 10000 +sleep 5000 print ======== step5 system sh/exec_up.sh -n dnode3 -s start -sleep 10000 +sleep 5000 system sh/exec_up.sh -n dnode2 -s stop -sleep 10000 +sleep 5000 print ======== step6 sql select count(*) from db1.tb1 @@ -108,7 +108,7 @@ print ======== step7 print ======== loop Times $x -if $x < 5 then +if $x < 2 then $x = $x + 1 goto loop endi diff --git a/tests/script/unique/vnode/replica2_basic.sim b/tests/script/unique/vnode/replica2_basic.sim deleted file mode 100644 index a0ea7085cb08922303dda014e3fd4322f6a71773..0000000000000000000000000000000000000000 --- a/tests/script/unique/vnode/replica2_basic.sim +++ /dev/null @@ -1,199 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 -system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 -system sh/exec_up.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -system sh/exec_up.sh -n dnode2 -s start -sleep 3000 - -$N = 10 -$db = d1 -$table = table_r2 - -print =================== step 1 -sql create database $db replica 3 -sql use $db -sql create table $table (ts timestamp, speed int) -x error_create -return -1 -error_create: -sql drop database $db - -print =================== step 2 - -sql create database $db replica 2 -sql use $db - -sql create table $table (ts timestamp, speed int) -sleep 1000 - -print =================== step 3 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec_up.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec_up.sh -n dnode2 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec_up.sh -n dnode1 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 4 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 7 -system sh/exec_up.sh -n dnode1 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 5 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 8 -system sh/ip.sh -i 1 -s down - -sleep 2000 -$y = $x + $N -$expect = $N * 6 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 9 - -sleep 2000 -$y = $x + $N -$expect = $N * 7 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 10 -system sh/ip.sh -i 2 -s down - -sleep 2000 -$y = $x + $N -$expect = $N * 8 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 11 - -sleep 2000 -$y = $x + $N -$expect = $N * 9 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 12 - -system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -system sh/exec_up.sh -n dnode4 -s stop -x SIGINT -system sh/exec_up.sh -n dnode5 -s stop -x SIGINT -system sh/exec_up.sh -n dnode6 -s stop -x SIGINT -system sh/exec_up.sh -n dnode7 -s stop -x SIGINT -system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim index f7da1babb73914d58661a180b5cc7b3ddc8681ba..a6bd226484cf10dcbc2bcd8d4687e69b0fed63a7 100644 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ b/tests/script/unique/vnode/replica2_repeat.sim @@ -33,7 +33,7 @@ sql select count(*) from db.tb $lastRows = $rows print ======== step2 -run_back cluster/vnode/back_insert.sim +run_back unique/vnode/back_insert.sim sleep 3000 print ======== step3 @@ -66,7 +66,7 @@ print ======== step7 $lastRows = $data00 print ======== loop Times $x -if $x < 5 then +if $x < 2 then $x = $x + 1 goto loop endi diff --git a/tests/script/unique/vnode/replica3_repeat.sim b/tests/script/unique/vnode/replica3_repeat.sim index 8c3ed902fb1508f4ce0d714f1455ad5546826957..2f311a5d7a5fbba7eb754ac65b281947038fdaa0 100644 --- a/tests/script/unique/vnode/replica3_repeat.sim +++ b/tests/script/unique/vnode/replica3_repeat.sim @@ -36,7 +36,7 @@ sql select count(*) from db.tb $lastRows = $rows print ======== step2 -run_back cluster/vnode/back_insert.sim +run_back unique/vnode/back_insert.sim sleep 3000 print ======== step3 @@ -75,7 +75,7 @@ print ======== step8 $lastRows = $data00 print ======== loop Times $x -if $x < 5 then +if $x < 2 then $x = $x + 1 goto loop endi diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim index f63bf1783d60f67c81a51a104f737033ccceb237..6315a4335cf47abe6f3b42ca7db4a2406fc90c5f 100644 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ b/tests/script/unique/vnode/replica3_vgroup.sim @@ -33,7 +33,7 @@ sleep 3001 $tbPre = m -$N = 280 +$N = 300 $x = 0 $y = $x + $N while $x < $y @@ -46,20 +46,20 @@ endw #print =================== step 2 -#$x = 1 -#$y = $x + $N -#$expect = $N -#while $x < $y -# $ms = $x . m -# sql insert into $table values (now + $ms , $x ) -# $x = $x + 1 -#endw +$x = -500 +$y = $x + $N +while $x < $y + $ms = $x . m + sql insert into $table values (now $ms , $x ) + $x = $x + 1 +endw -#sql select * from $table -#print sql select * from $table -> $rows points -#if $rows != $expect then -# return -1 -#endi +$expect = $N + 1 +sql select * from $table +print sql select * from $table -> $rows points expect $expect +if $rows != $expect then + return -1 +endi system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT diff --git a/tests/script/unique/vnode/testSuite.sim b/tests/script/unique/vnode/testSuite.sim index 46b01aaa45f2eef6fc37e523c724d6bab1244662..3a9db66beb77d29b7d6bcb68d070edd91c97e199 100644 --- a/tests/script/unique/vnode/testSuite.sim +++ b/tests/script/unique/vnode/testSuite.sim @@ -1,6 +1,4 @@ -run unique/vnode/commit.sim run unique/vnode/many.sim -run unique/vnode/replica2_basic.sim run unique/vnode/replica2_basic2.sim run unique/vnode/replica2_repeat.sim run unique/vnode/replica3_basic.sim