From 7a961f1d1f54f804a6b632108f0d4f1413b834c0 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 23 Dec 2024 19:10:37 +0800 Subject: [PATCH] feat: add taos-tools cases to army --- tests/army/tools/benchmark/basic/bugs.py | 176 +++++++ .../basic/commandline-partial-col-numpy.py | 80 ++++ .../benchmark/basic/commandline-retry.py | 89 ++++ .../basic/commandline-single-table.py | 99 ++++ .../benchmark/basic/commandline-sml-rest.py | 101 +++++ .../tools/benchmark/basic/commandline-sml.py | 105 +++++ .../basic/commandline-supplement-insert.py | 79 ++++ .../benchmark/basic/commandline-vgroups.py | 76 ++++ .../army/tools/benchmark/basic/commandline.py | 358 +++++++++++++++ .../tools/benchmark/basic/csv/TD-31490.csv | 50 ++ .../tools/benchmark/basic/csv/TS-5002.csv | 103 +++++ tests/army/tools/benchmark/basic/csv/d0.csv | 200 ++++++++ .../benchmark/basic/csv/insert-json-csv.csv | 10 + .../benchmark/basic/csv/nano_samples.csv | 100 ++++ .../benchmark/basic/csv/nano_sampletags.csv | 100 ++++ .../army/tools/benchmark/basic/csv/sample.csv | 3 + .../benchmark/basic/csv/sample_no_ts.csv | 4 + .../tools/benchmark/basic/csv/sample_tags.csv | 2 + .../tools/benchmark/basic/csv/sample_ts.csv | 4 + .../basic/csv/sample_ts_stmt_tags.csv | 2 + .../basic/csv/sample_use_ts-stb3.csv | 4 + .../basic/csv/sample_use_ts-stb5.csv | 4 + .../benchmark/basic/csv/sample_use_ts.csv | 4 + tests/army/tools/benchmark/basic/csv/tags.csv | 2 + .../tools/benchmark/basic/custom_col_tag.py | 91 ++++ .../tools/benchmark/basic/default_json.py | 73 +++ .../tools/benchmark/basic/default_tmq_json.py | 91 ++++ tests/army/tools/benchmark/basic/demo.py | 100 ++++ tests/army/tools/benchmark/basic/exportCsv.py | 147 ++++++ .../tools/benchmark/basic/from-to-continue.py | 101 +++++ tests/army/tools/benchmark/basic/from-to.py | 86 ++++ .../tools/benchmark/basic/insert-json-csv.py | 89 ++++ .../benchmark/basic/invalid_commandline.py | 93 ++++ .../tools/benchmark/basic/json/TD-31490.json | 63 +++ .../tools/benchmark/basic/json/TD-31575.json | 81 ++++ .../tools/benchmark/basic/json/TD-32846.json | 82 ++++ .../benchmark/basic/json/TD-32913-1.json | 67 +++ .../benchmark/basic/json/TD-32913-2.json | 67 +++ .../benchmark/basic/json/TD-32913-3.json | 66 +++ .../tools/benchmark/basic/json/TD-32913.json | 66 +++ .../tools/benchmark/basic/json/TS-5002.json | 155 +++++++ .../tools/benchmark/basic/json/TS-5234-1.json | 78 ++++ .../tools/benchmark/basic/json/TS-5234-2.json | 78 ++++ .../tools/benchmark/basic/json/TS-5234-3.json | 76 ++++ .../basic/json/case-insert-mix1.json | 76 ++++ .../basic/json/case-insert-mix2.json | 76 ++++ .../basic/json/case-insert-mix3.json | 70 +++ .../basic/json/case-insert-mix4.json | 74 +++ .../benchmark/basic/json/custom_col_tag.json | 77 ++++ .../tools/benchmark/basic/json/default.json | 29 ++ .../tools/benchmark/basic/json/exportCsv.json | 78 ++++ .../tools/benchmark/basic/json/from-to.json | 33 ++ .../basic/json/insert-disorder-stmt.json | 75 +++ .../benchmark/basic/json/insert-disorder.json | 87 ++++ .../json/insert-drop-exist-auto-N00-stmt.json | 168 +++++++ .../json/insert-drop-exist-auto-Y00-stmt.json | 168 +++++++ .../json/insert-from-to-continue-no.json | 84 ++++ .../json/insert-from-to-continue-smart.json | 84 ++++ .../json/insert-from-to-continue-yes.json | 84 ++++ .../basic/json/insert-interlace-row-stmt.json | 49 ++ .../basic/json/insert-interlace-row.json | 61 +++ .../benchmark/basic/json/insert-json-csv.json | 48 ++ .../basic/json/insert-sample-ts-stmt.json | 76 ++++ .../basic/json/insert-sample-ts.json | 76 ++++ .../benchmark/basic/json/insert-sample.json | 87 ++++ .../basic/json/insert-timestep-stmt.json | 75 +++ .../benchmark/basic/json/insert-timestep.json | 87 ++++ .../benchmark/basic/json/queryInsertdata.json | 73 +++ .../basic/json/queryInsertrestdata.json | 73 +++ .../tools/benchmark/basic/json/queryQps.json | 35 ++ .../benchmark/basic/json/queryRestful.json | 38 ++ .../basic/json/querySpeciMutisql100.json | 429 ++++++++++++++++++ .../basic/json/querySuperMutisql100.json | 419 +++++++++++++++++ .../basic/json/queryTaosc-mixed-query.json | 38 ++ .../benchmark/basic/json/queryTaosc.json | 37 ++ .../basic/json/rest_auto_create_table.json | 74 +++ .../basic/json/rest_insert_alltypes.json | 49 ++ .../benchmark/basic/json/rest_query.json | 27 ++ .../benchmark/basic/json/reuse-exist-stb.json | 63 +++ .../basic/json/sml_auto_create_table.json | 73 +++ .../basic/json/sml_insert_alltypes.json | 48 ++ .../benchmark/basic/json/sml_interlace.json | 73 +++ .../json/sml_json_alltypes-interlace.json | 248 ++++++++++ .../basic/json/sml_json_alltypes.json | 248 ++++++++++ ...sml_json_insert_alltypes-same-min-max.json | 44 ++ .../benchmark/basic/json/sml_rest_json.json | 93 ++++ .../benchmark/basic/json/sml_rest_line.json | 253 +++++++++++ .../benchmark/basic/json/sml_rest_telnet.json | 173 +++++++ .../basic/json/sml_taosjson_alltypes.json | 248 ++++++++++ ...taosjson_insert_alltypes-same-min-max.json | 44 ++ .../basic/json/sml_telnet_alltypes.json | 348 ++++++++++++++ ...l_telnet_insert_alltypes-same-min-max.json | 44 ++ .../benchmark/basic/json/sml_telnet_tcp.json | 73 +++ .../basic/json/specified_subscribe.json | 24 + .../json/stmt2_insert_batch_autoctb_no.json | 50 ++ .../json/stmt2_insert_batch_autoctb_yes.json | 50 ++ .../stmt2_insert_csv_batch_autoctb_no.json | 53 +++ ...tmt2_insert_csv_interlace_autoctb_yes.json | 53 +++ .../stmt2_insert_interlace_autoctb_no.json | 50 ++ .../stmt2_insert_interlace_autoctb_yes.json | 50 ++ .../basic/json/stmt_auto_create_table.json | 72 +++ .../stmt_insert_alltypes-same-min-max.json | 43 ++ .../basic/json/stmt_insert_alltypes.json | 57 +++ .../basic/json/stmt_limit_offset.json | 49 ++ .../basic/json/stmt_sample_doesnt_use_ts.json | 49 ++ .../json/stmt_sample_use_ts-subtable.json | 49 ++ .../basic/json/stmt_sample_use_ts.json | 49 ++ .../benchmark/basic/json/stream-test.json | 114 +++++ ...stream_exist_stb_tag_insert_partition.json | 104 +++++ .../json/stream_exist_stb_tag_prepare.json | 143 ++++++ .../benchmark/basic/json/super_subscribe.json | 24 + .../basic/json/taosc_auto_create_table.json | 76 ++++ .../taosc_insert_alltypes-partial-col.json | 57 +++ .../taosc_insert_alltypes-same-min-max.json | 43 ++ .../basic/json/taosc_insert_alltypes.json | 56 +++ .../basic/json/taosc_insert_retry-global.json | 45 ++ .../basic/json/taosc_insert_retry-stb.json | 45 ++ .../taosc_insert_table-creating-interval.json | 47 ++ .../benchmark/basic/json/taosc_json_tag.json | 48 ++ .../basic/json/taosc_limit_offset.json | 49 ++ .../basic/json/taosc_only_create_table.json | 48 ++ .../basic/json/taosc_query-error-sqlfile.json | 20 + .../json/taosc_query-kill-slow-query.json | 19 + .../basic/json/taosc_query-sqlfile.json | 19 + .../benchmark/basic/json/taosc_query.json | 33 ++ .../json/taosc_sample_use_ts-subtable.json | 49 ++ .../basic/json/taosc_sample_use_ts.json | 49 ++ .../basic/json/taosdemoTestNanoDatabase.json | 87 ++++ .../json/taosdemoTestNanoDatabaseNow.json | 61 +++ .../json/taosdemoTestNanoDatabasecsv.json | 83 ++++ .../army/tools/benchmark/basic/json/tmq.json | 28 ++ .../tools/benchmark/basic/json/tmq_basic.json | 28 ++ .../benchmark/basic/json/tmq_basic2.json | 29 ++ .../benchmark/basic/json/tmq_basic3.json | 27 ++ tests/army/tools/benchmark/basic/json_tag.py | 76 ++++ .../benchmark/basic/limit_offset_json.py | 126 +++++ .../basic/query_json-kill-slow-query.py | 88 ++++ .../basic/query_json-with-error-sqlfile.py | 84 ++++ .../basic/query_json-with-sqlfile.py | 84 ++++ .../army/tools/benchmark/basic/query_json.py | 129 ++++++ .../basic/rest_insert_alltypes_json.py | 110 +++++ .../tools/benchmark/basic/reuse-exist-stb.py | 92 ++++ .../basic/sml_auto_create_table_json.py | 78 ++++ .../basic/sml_insert_alltypes_json.py | 107 +++++ .../tools/benchmark/basic/sml_interlace.py | 92 ++++ .../basic/sml_json_alltypes-interlace.py | 124 +++++ .../benchmark/basic/sml_json_alltypes.py | 124 +++++ .../sml_json_insert_alltypes-same-min-max.py | 103 +++++ .../benchmark/basic/sml_taosjson_alltypes.py | 124 +++++ ...l_taosjson_insert_alltypes-same-min-max.py | 87 ++++ .../benchmark/basic/sml_telnet_alltypes.py | 142 ++++++ ...sml_telnet_insert_alltypes-same-min-max.py | 110 +++++ .../tools/benchmark/basic/stmt2_insert.py | 108 +++++ .../basic/stmt_auto_create_table_json.py | 78 ++++ .../stmt_insert_alltypes-same-min-max.py | 91 ++++ .../basic/stmt_insert_alltypes_json.py | 165 +++++++ .../tools/benchmark/basic/stmt_offset_json.py | 126 +++++ .../basic/stmt_sample_csv_json-subtable.py | 102 +++++ .../benchmark/basic/stmt_sample_csv_json.py | 87 ++++ .../stmt_sample_csv_json_doesnt_use_ts.py | 87 ++++ .../army/tools/benchmark/basic/stream-test.py | 73 +++ .../benchmark/basic/stream_function_test.py | 76 ++++ .../tools/benchmark/basic/taosadapter_json.py | 99 ++++ .../basic/taosc_auto_create_table_json.py | 127 ++++++ .../tools/benchmark/basic/taosc_insert-mix.py | 85 ++++ .../basic/taosc_insert-retry-json-global.py | 85 ++++ .../basic/taosc_insert-retry-json-stb.py | 85 ++++ .../taosc_insert-table-creating-interval.py | 89 ++++ .../taosc_insert_alltypes-same-min-max.py | 91 ++++ .../taosc_insert_alltypes_json-partial-col.py | 125 +++++ .../basic/taosc_insert_alltypes_json.py | 170 +++++++ .../basic/taosc_sample_csv_json-subtable.py | 102 +++++ .../benchmark/basic/taosc_sample_csv_json.py | 87 ++++ ...aosdemoTestInsertWithJsonStmt-otherPara.py | 226 +++++++++ .../taosdemoTestQueryWithJson-mixed-query.py | 217 +++++++++ .../basic/taosdemoTestQueryWithJson.py | 239 ++++++++++ .../army/tools/benchmark/basic/telnet_tcp.py | 97 ++++ tests/army/tools/benchmark/basic/tmq_case.py | 97 ++++ .../army/tools/benchmark/cloud/cloud-test.py | 84 ++++ tests/army/tools/benchmark/ws/websocket.py | 71 +++ .../tools/taosdump/native/json/geometry.json | 47 ++ .../tools/taosdump/native/json/varbinary.json | 47 ++ .../tools/taosdump/native/taosdumpDbNtb.py | 138 ++++++ .../tools/taosdump/native/taosdumpDbStb.py | 138 ++++++ .../taosdump/native/taosdumpDbWithNonRoot.py | 140 ++++++ .../taosdump/native/taosdumpEscapedDb.py | 124 +++++ .../taosdump/native/taosdumpInDiffType.py | 120 +++++ .../tools/taosdump/native/taosdumpManyCols.py | 147 ++++++ .../taosdump/native/taosdumpStartEndTime.py | 145 ++++++ .../native/taosdumpStartEndTimeLong.py | 145 ++++++ .../tools/taosdump/native/taosdumpTest.py | 211 +++++++++ .../tools/taosdump/native/taosdumpTest2.py | 163 +++++++ .../taosdump/native/taosdumpTestBasic.py | 138 ++++++ .../taosdump/native/taosdumpTestInspect.py | 170 +++++++ .../taosdump/native/taosdumpTestLooseMode.py | 128 ++++++ .../native/taosdumpTestNanoSupport.py | 322 +++++++++++++ .../taosdump/native/taosdumpTestTypeBigInt.py | 150 ++++++ .../taosdump/native/taosdumpTestTypeBinary.py | 144 ++++++ .../taosdump/native/taosdumpTestTypeBool.py | 147 ++++++ .../taosdump/native/taosdumpTestTypeDouble.py | 171 +++++++ .../taosdump/native/taosdumpTestTypeFloat.py | 170 +++++++ .../taosdump/native/taosdumpTestTypeInt.py | 147 ++++++ .../taosdump/native/taosdumpTestTypeJson.py | 162 +++++++ .../native/taosdumpTestTypeSmallInt.py | 148 ++++++ .../native/taosdumpTestTypeTinyInt.py | 150 ++++++ .../native/taosdumpTestTypeUnsignedBigInt.py | 141 ++++++ .../native/taosdumpTestTypeUnsignedInt.py | 141 ++++++ .../taosdumpTestTypeUnsignedSmallInt.py | 141 ++++++ .../native/taosdumpTestTypeUnsignedTinyInt.py | 141 ++++++ .../taosdump/native/taosdumpTypeGeometry.py | 244 ++++++++++ .../taosdump/native/taosdumpTypeVarbinary.py | 247 ++++++++++ .../tools/taosdump/ws3/json/primaryKey.json | 71 +++ tests/army/tools/taosdump/ws3/json/retry.json | 61 +++ .../tools/taosdump/ws3/taosdumpEscapedDb.py | 124 +++++ .../tools/taosdump/ws3/taosdumpPrimaryKey.py | 206 +++++++++ .../army/tools/taosdump/ws3/taosdumpRetry.py | 264 +++++++++++ .../taosdump/ws3/taosdumpTestTypeBigInt.py | 150 ++++++ .../taosdump/ws3/taosdumpTestTypeBinary.py | 144 ++++++ .../taosdump/ws3/taosdumpTestTypeBool.py | 149 ++++++ .../taosdump/ws3/taosdumpTestTypeDouble.py | 174 +++++++ .../taosdump/ws3/taosdumpTestTypeFloat.py | 170 +++++++ .../tools/taosdump/ws3/taosdumpTestTypeInt.py | 149 ++++++ .../taosdump/ws3/taosdumpTestTypeJson.py | 162 +++++++ .../taosdump/ws3/taosdumpTestTypeSmallInt.py | 148 ++++++ .../taosdump/ws3/taosdumpTestTypeTinyInt.py | 153 +++++++ .../ws3/taosdumpTestTypeUnsignedBigInt.py | 142 ++++++ .../ws3/taosdumpTestTypeUnsignedInt.py | 144 ++++++ .../ws3/taosdumpTestTypeUnsignedSmallInt.py | 142 ++++++ .../ws3/taosdumpTestTypeUnsignedTinyInt.py | 142 ++++++ 229 files changed, 23332 insertions(+) create mode 100644 tests/army/tools/benchmark/basic/bugs.py create mode 100644 tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py create mode 100644 tests/army/tools/benchmark/basic/commandline-retry.py create mode 100644 tests/army/tools/benchmark/basic/commandline-single-table.py create mode 100644 tests/army/tools/benchmark/basic/commandline-sml-rest.py create mode 100644 tests/army/tools/benchmark/basic/commandline-sml.py create mode 100644 tests/army/tools/benchmark/basic/commandline-supplement-insert.py create mode 100644 tests/army/tools/benchmark/basic/commandline-vgroups.py create mode 100644 tests/army/tools/benchmark/basic/commandline.py create mode 100644 tests/army/tools/benchmark/basic/csv/TD-31490.csv create mode 100644 tests/army/tools/benchmark/basic/csv/TS-5002.csv create mode 100644 tests/army/tools/benchmark/basic/csv/d0.csv create mode 100644 tests/army/tools/benchmark/basic/csv/insert-json-csv.csv create mode 100644 tests/army/tools/benchmark/basic/csv/nano_samples.csv create mode 100644 tests/army/tools/benchmark/basic/csv/nano_sampletags.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_no_ts.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_tags.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_ts.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_ts_stmt_tags.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_use_ts-stb3.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_use_ts-stb5.csv create mode 100644 tests/army/tools/benchmark/basic/csv/sample_use_ts.csv create mode 100644 tests/army/tools/benchmark/basic/csv/tags.csv create mode 100644 tests/army/tools/benchmark/basic/custom_col_tag.py create mode 100644 tests/army/tools/benchmark/basic/default_json.py create mode 100644 tests/army/tools/benchmark/basic/default_tmq_json.py create mode 100644 tests/army/tools/benchmark/basic/demo.py create mode 100644 tests/army/tools/benchmark/basic/exportCsv.py create mode 100644 tests/army/tools/benchmark/basic/from-to-continue.py create mode 100644 tests/army/tools/benchmark/basic/from-to.py create mode 100644 tests/army/tools/benchmark/basic/insert-json-csv.py create mode 100644 tests/army/tools/benchmark/basic/invalid_commandline.py create mode 100644 tests/army/tools/benchmark/basic/json/TD-31490.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-31575.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-32846.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-32913-1.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-32913-2.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-32913-3.json create mode 100644 tests/army/tools/benchmark/basic/json/TD-32913.json create mode 100644 tests/army/tools/benchmark/basic/json/TS-5002.json create mode 100644 tests/army/tools/benchmark/basic/json/TS-5234-1.json create mode 100644 tests/army/tools/benchmark/basic/json/TS-5234-2.json create mode 100644 tests/army/tools/benchmark/basic/json/TS-5234-3.json create mode 100644 tests/army/tools/benchmark/basic/json/case-insert-mix1.json create mode 100644 tests/army/tools/benchmark/basic/json/case-insert-mix2.json create mode 100644 tests/army/tools/benchmark/basic/json/case-insert-mix3.json create mode 100644 tests/army/tools/benchmark/basic/json/case-insert-mix4.json create mode 100644 tests/army/tools/benchmark/basic/json/custom_col_tag.json create mode 100644 tests/army/tools/benchmark/basic/json/default.json create mode 100644 tests/army/tools/benchmark/basic/json/exportCsv.json create mode 100644 tests/army/tools/benchmark/basic/json/from-to.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-disorder-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-disorder.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-N00-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-Y00-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-from-to-continue-no.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-from-to-continue-smart.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-from-to-continue-yes.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-interlace-row-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-interlace-row.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-json-csv.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-sample-ts.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-sample.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-timestep-stmt.json create mode 100644 tests/army/tools/benchmark/basic/json/insert-timestep.json create mode 100644 tests/army/tools/benchmark/basic/json/queryInsertdata.json create mode 100644 tests/army/tools/benchmark/basic/json/queryInsertrestdata.json create mode 100644 tests/army/tools/benchmark/basic/json/queryQps.json create mode 100644 tests/army/tools/benchmark/basic/json/queryRestful.json create mode 100644 tests/army/tools/benchmark/basic/json/querySpeciMutisql100.json create mode 100644 tests/army/tools/benchmark/basic/json/querySuperMutisql100.json create mode 100644 tests/army/tools/benchmark/basic/json/queryTaosc-mixed-query.json create mode 100644 tests/army/tools/benchmark/basic/json/queryTaosc.json create mode 100644 tests/army/tools/benchmark/basic/json/rest_auto_create_table.json create mode 100644 tests/army/tools/benchmark/basic/json/rest_insert_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/rest_query.json create mode 100644 tests/army/tools/benchmark/basic/json/reuse-exist-stb.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_auto_create_table.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_insert_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_interlace.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_json_alltypes-interlace.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_json_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_json_insert_alltypes-same-min-max.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_rest_json.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_rest_line.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_rest_telnet.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_taosjson_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_taosjson_insert_alltypes-same-min-max.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_telnet_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_telnet_insert_alltypes-same-min-max.json create mode 100644 tests/army/tools/benchmark/basic/json/sml_telnet_tcp.json create mode 100644 tests/army/tools/benchmark/basic/json/specified_subscribe.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_no.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_yes.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_no.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_yes.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_auto_create_table.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_insert_alltypes-same-min-max.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_insert_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_limit_offset.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json create mode 100644 tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json create mode 100644 tests/army/tools/benchmark/basic/json/stream-test.json create mode 100644 tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_insert_partition.json create mode 100644 tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_prepare.json create mode 100644 tests/army/tools/benchmark/basic/json/super_subscribe.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_auto_create_table.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-partial-col.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-same-min-max.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_alltypes.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_retry-global.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_retry-stb.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_insert_table-creating-interval.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_json_tag.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_limit_offset.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_only_create_table.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_query.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json create mode 100644 tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json create mode 100644 tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabase.json create mode 100644 tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabaseNow.json create mode 100644 tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json create mode 100644 tests/army/tools/benchmark/basic/json/tmq.json create mode 100644 tests/army/tools/benchmark/basic/json/tmq_basic.json create mode 100644 tests/army/tools/benchmark/basic/json/tmq_basic2.json create mode 100644 tests/army/tools/benchmark/basic/json/tmq_basic3.json create mode 100644 tests/army/tools/benchmark/basic/json_tag.py create mode 100644 tests/army/tools/benchmark/basic/limit_offset_json.py create mode 100644 tests/army/tools/benchmark/basic/query_json-kill-slow-query.py create mode 100644 tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py create mode 100644 tests/army/tools/benchmark/basic/query_json-with-sqlfile.py create mode 100644 tests/army/tools/benchmark/basic/query_json.py create mode 100644 tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py create mode 100644 tests/army/tools/benchmark/basic/reuse-exist-stb.py create mode 100644 tests/army/tools/benchmark/basic/sml_auto_create_table_json.py create mode 100644 tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py create mode 100644 tests/army/tools/benchmark/basic/sml_interlace.py create mode 100644 tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py create mode 100644 tests/army/tools/benchmark/basic/sml_json_alltypes.py create mode 100644 tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py create mode 100644 tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py create mode 100644 tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py create mode 100644 tests/army/tools/benchmark/basic/sml_telnet_alltypes.py create mode 100644 tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py create mode 100644 tests/army/tools/benchmark/basic/stmt2_insert.py create mode 100644 tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py create mode 100644 tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py create mode 100644 tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py create mode 100644 tests/army/tools/benchmark/basic/stmt_offset_json.py create mode 100644 tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py create mode 100644 tests/army/tools/benchmark/basic/stmt_sample_csv_json.py create mode 100644 tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py create mode 100644 tests/army/tools/benchmark/basic/stream-test.py create mode 100644 tests/army/tools/benchmark/basic/stream_function_test.py create mode 100644 tests/army/tools/benchmark/basic/taosadapter_json.py create mode 100644 tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert-mix.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py create mode 100644 tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py create mode 100644 tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py create mode 100644 tests/army/tools/benchmark/basic/taosc_sample_csv_json.py create mode 100644 tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py create mode 100644 tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py create mode 100644 tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py create mode 100644 tests/army/tools/benchmark/basic/telnet_tcp.py create mode 100644 tests/army/tools/benchmark/basic/tmq_case.py create mode 100644 tests/army/tools/benchmark/cloud/cloud-test.py create mode 100644 tests/army/tools/benchmark/ws/websocket.py create mode 100644 tests/army/tools/taosdump/native/json/geometry.json create mode 100644 tests/army/tools/taosdump/native/json/varbinary.json create mode 100644 tests/army/tools/taosdump/native/taosdumpDbNtb.py create mode 100644 tests/army/tools/taosdump/native/taosdumpDbStb.py create mode 100644 tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py create mode 100644 tests/army/tools/taosdump/native/taosdumpEscapedDb.py create mode 100644 tests/army/tools/taosdump/native/taosdumpInDiffType.py create mode 100644 tests/army/tools/taosdump/native/taosdumpManyCols.py create mode 100644 tests/army/tools/taosdump/native/taosdumpStartEndTime.py create mode 100644 tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTest.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTest2.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestBasic.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestInspect.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestLooseMode.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeBool.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeJson.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTypeGeometry.py create mode 100644 tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py create mode 100644 tests/army/tools/taosdump/ws3/json/primaryKey.json create mode 100644 tests/army/tools/taosdump/ws3/json/retry.json create mode 100644 tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpRetry.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py create mode 100644 tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py diff --git a/tests/army/tools/benchmark/basic/bugs.py b/tests/army/tools/benchmark/basic/bugs.py new file mode 100644 index 0000000000..ec20a7e995 --- /dev/null +++ b/tests/army/tools/benchmark/basic/bugs.py @@ -0,0 +1,176 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import json +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +# reomve single and double quotation +def removeQuotation(origin): + value = "" + for c in origin: + if c != '\'' and c != '"': + value += c + + return value + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def testBenchmarkJson(self, benchmark, jsonFile, options="", checkStep=False): + # exe insert + cmd = f"{benchmark} {options} -f {jsonFile}" + os.system(cmd) + + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + db = data["databases"][0]["dbinfo"]["name"] + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + # drop + try: + drop = data["databases"][0]["dbinfo"]["drop"] + except: + drop = "yes" + + # command is first + if options.find("-Q") != -1: + drop = "no" + + + # cachemodel + try: + cachemode = data["databases"][0]["dbinfo"]["cachemodel"] + except: + cachemode = None + + # vgropus + try: + vgroups = data["databases"][0]["dbinfo"]["vgroups"] + except: + vgroups = None + + tdLog.info(f"get json info: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + if checkStep: + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + if drop.lower() == "yes": + # check database optins + sql = f"select `vgroups`,`cachemodel` from information_schema.ins_databases where name='{db}';" + tdSql.query(sql) + + if cachemode != None: + value = removeQuotation(cachemode) + tdLog.info(f" deal both origin={cachemode} after={value}") + tdSql.checkData(0, 1, value) + + if vgroups != None: + tdSql.checkData(0, 0, vgroups) + + + # bugs ts + def bugsTS(self, benchmark): + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5002.json") + # TS-5234 + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-1.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-2.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-3.json") + + # bugs td + def bugsTD(self, benchmark): + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-31490.json", checkStep = False) + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-31575.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32846.json") + + # no drop + db = "td32913db" + vgroups = 4 + tdSql.execute(f"create database {db} vgroups {vgroups}") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913.json", options="-Q") + tdSql.query(f"select `vgroups` from information_schema.ins_databases where name='{db}';") + tdSql.checkData(0, 0, vgroups) + + # other + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-1.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-2.json", options="-T 6") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-3.json") + + def run(self): + benchmark = self.getPath() + + # ts + self.bugsTS(benchmark) + + # td + self.bugsTD(benchmark) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py b/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py new file mode 100644 index 0000000000..da6869a9ee --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py @@ -0,0 +1,80 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19387] taosBenchmark support partial columns num + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -t 1 -n 1 -y -L 2 " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + tdSql.query("select * from test.meters") + dbresult = tdSql.queryResult + for i in range(len(dbresult[0])): + if i in (1, 2) and dbresult[0][i] is None: + tdLog.exit("result[0][%d] is NULL, which should not be" % i) + else: + tdLog.info("result[0][{0}] is {1}".format(i, dbresult[0][i])) + + tdSql.checkData(0, 0, 1500000000000) + tdSql.checkData(0, 3, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-retry.py b/tests/army/tools/benchmark/basic/commandline-retry.py new file mode 100644 index 0000000000..c8ff17a3ba --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-retry.py @@ -0,0 +1,89 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19985] taosBenchmark retry test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -t 1 -n 10 -i 1000 -r 1 -k 10 -z 1000 -y &" + # "%s -t 1 -n 10 -i 5000 -r 1 -y &" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(2) + tdDnodes.stopAll() + time.sleep(2) + tdDnodes.start(1) + time.sleep(2) + + psCmd = "ps -ef|grep -w taosBenchmark| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + + while processID: + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-single-table.py b/tests/army/tools/benchmark/basic/commandline-single-table.py new file mode 100644 index 0000000000..7fe1d097d9 --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-single-table.py @@ -0,0 +1,99 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21063] taosBenchmark single table test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -N -I taosc -t 1 -n 1 -y -E" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(1) + tdSql.query("select count(*) from `meters`") + tdSql.checkData(0, 0, 1) + + cmd = "%s -N -I rest -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(1) + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -N -I stmt -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(1) + tdSql.query("select count(*) from meters") + tdSql.checkData(0, 0, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-sml-rest.py b/tests/army/tools/benchmark/basic/commandline-sml-rest.py new file mode 100644 index 0000000000..b9277c115f --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-sml-rest.py @@ -0,0 +1,101 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +def getPath(tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + +class TDTestCase: + def caseDescription(self): + """ + [TD-22334] taosBenchmark sml rest test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + binPath = getPath() + + cmd = "%s -I sml-rest -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-rest-line -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-rest-telnet -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-rest-json -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-rest-taosjson -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -N -I sml-rest -y" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-sml.py b/tests/army/tools/benchmark/basic/commandline-sml.py new file mode 100644 index 0000000000..9994b35c61 --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-sml.py @@ -0,0 +1,105 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import time + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +def getPath(tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21932] taosBenchmark sml test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + binPath = getPath() + + cmd = "%s -I sml -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-line -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-telnet -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-json -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml-taosjson -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + cmd = "%s -I sml -t 10 -n 10000 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 10*10000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-supplement-insert.py b/tests/army/tools/benchmark/basic/commandline-supplement-insert.py new file mode 100644 index 0000000000..85dba23c4d --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-supplement-insert.py @@ -0,0 +1,79 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19352] taosBenchmark supplement insert test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -t 1 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + cmd = "%s -t 1 -n 10 -U -s 1600000000000 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 11) + tdSql.query("select * from test.meters") + tdSql.checkData(0, 0, 1500000000000) + tdSql.checkData(1, 0, 1600000000000) + tdSql.checkData(10, 0, 1600000000010) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline-vgroups.py b/tests/army/tools/benchmark/basic/commandline-vgroups.py new file mode 100644 index 0000000000..4292e227d0 --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline-vgroups.py @@ -0,0 +1,76 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21806] taosBenchmark specifying vgroups test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -t 1 -n 1 -v 3 -y &" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(2) + + tdSql.query("select `vgroups` from information_schema.ins_databases where name='test'") + tdSql.checkData(0, 0, 3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py new file mode 100644 index 0000000000..dcec514662 --- /dev/null +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -0,0 +1,358 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -F 7 -n 10 -t 2 -x -y -M -C -d newtest -l 5 -A binary,nchar\(31\) -b tinyint,binary\(23\),bool,nchar -w 29 -E -m $%%^*" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use newtest") + tdSql.query("select count(*) from newtest.meters") + tdSql.checkData(0, 0, 20) + tdSql.query("describe meters") + tdSql.checkRows(8) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "TINYINT") + # 2.x is binary and 3.x is varchar + # tdSql.checkData(2, 1, "BINARY") + tdSql.checkData(2, 2, 23) + tdSql.checkData(3, 1, "BOOL") + tdSql.checkData(4, 1, "NCHAR") + tdSql.checkData(4, 2, 29) + tdSql.checkData(5, 1, "INT") + # 2.x is binary and 3.x is varchar + # tdSql.checkData(6, 1, "BINARY") + tdSql.checkData(6, 2, 29) + tdSql.checkData(6, 3, "TAG") + tdSql.checkData(7, 1, "NCHAR") + tdSql.checkData(7, 2, 31) + tdSql.checkData(7, 3, "TAG") + tdSql.query("show tables") + tdSql.checkRows(2) + tdSql.execute("drop database if exists newtest") + + cmd = ( + "%s -t 2 -n 10 -b bool,tinyint,smallint,int,bigint,float,double,utinyint,usmallint,uint,ubigint,binary,nchar,timestamp -A bool,tinyint,smallint,int,bigint,float,double,utinyint,usmallint,uint,ubigint,binary,nchar,timestamp -y" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("show test.tables") + tdSql.checkRows(2) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 20) + + cmd = ( + "%s -I stmt -t 2 -n 10 -b bool,tinyint,smallint,int,bigint,float,double,utinyint,usmallint,uint,ubigint,binary,nchar,timestamp -A bool,tinyint,smallint,int,bigint,float,double,utinyint,usmallint,uint,ubigint,binary,nchar,timestamp -y" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("show test.tables") + tdSql.checkRows(2) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 20) + + cmd = "%s -F 7 -n 10 -t 2 -y -M -I stmt" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("show test.tables") + tdSql.checkRows(2) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 20) + + # add stmt2 + cmd = "%s -F 700 -n 1000 -t 4 -y -M -I stmt2" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("show test.tables") + tdSql.checkRows(4) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 4000) + + cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 2>&1 | grep sleep | wc -l" % binPath + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 2: + tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes)) + + cmd = ( + "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 2>&1 | grep sleep | wc -l" % binPath + ) + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 3: + tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes)) + + cmd = ( + "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I sml 2>&1 | grep sleep | wc -l" + % binPath + ) + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 2: + tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes)) + + cmd = ( + "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I sml 2>&1 | grep sleep | wc -l" + % binPath + ) + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 3: + tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes)) + + cmd = ( + "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I stmt 2>&1 | grep sleep | wc -l" + % binPath + ) + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 2: + tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes)) + + cmd = ( + "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I stmt 2>&1 | grep sleep | wc -l" + % binPath + ) + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + if int(sleepTimes) != 3: + tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes)) + + cmd = "%s -S 17 -n 3 -t 1 -y -x" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(2) # to avoid invalid vgroup id + tdSql.query("select last(ts) from test.meters") + tdSql.checkData(0, 0, "2017-07-14 10:40:00.034") + + cmd = "%s -N -I taosc -t 11 -n 11 -y -x -E" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(11) + tdSql.query("select count(*) from `d10`") + tdSql.checkData(0, 0, 11) + + cmd = "%s -N -I rest -t 11 -n 11 -y -x" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(11) + tdSql.query("select count(*) from d10") + tdSql.checkData(0, 0, 11) + + cmd = "%s -N -I stmt -t 11 -n 11 -y -x" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(0) + tdSql.query("show tables") + tdSql.checkRows(11) + tdSql.query("select count(*) from d10") + tdSql.checkData(0, 0, 11) + + cmd = "%s -n 1 -t 1 -y -b bool" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "BOOL") + + cmd = "%s -n 1 -t 1 -y -b tinyint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "TINYINT") + + cmd = "%s -n 1 -t 1 -y -b utinyint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "TINYINT UNSIGNED") + + cmd = "%s -n 1 -t 1 -y -b smallint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "SMALLINT") + + cmd = "%s -n 1 -t 1 -y -b usmallint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "SMALLINT UNSIGNED") + + cmd = "%s -n 1 -t 1 -y -b int" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "INT") + + cmd = "%s -n 1 -t 1 -y -b uint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "INT UNSIGNED") + + cmd = "%s -n 1 -t 1 -y -b bigint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "BIGINT") + + cmd = "%s -n 1 -t 1 -y -b ubigint" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "BIGINT UNSIGNED") + + cmd = "%s -n 1 -t 1 -y -b timestamp" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "TIMESTAMP") + + cmd = "%s -n 1 -t 1 -y -b float" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "FLOAT") + + cmd = "%s -n 1 -t 1 -y -b double" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "DOUBLE") + + cmd = "%s -n 1 -t 1 -y -b nchar" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "NCHAR") + + cmd = "%s -n 1 -t 1 -y -b nchar\(7\)" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(1, 1, "NCHAR") + + # 2.x is binary and 3.x is varchar + # cmd = "%s -n 1 -t 1 -y -b binary" %binPath + # tdLog.info("%s" % cmd) + # os.system("%s" % cmd) + # tdSql.execute("reset query cache") + # tdSql.query("describe test.meters") + # tdSql.checkData(1, 1, "BINARY") + + # cmd = "%s -n 1 -t 1 -y -b binary\(7\)" %binPath + # tdLog.info("%s" % cmd) + # os.system("%s" % cmd) + # tdSql.execute("reset query cache") + # tdSql.query("describe test.meters") + # tdSql.checkData(1, 1, "BINARY") + + cmd = "%s -n 1 -t 1 -y -A json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe test.meters") + tdSql.checkData(4, 1, "JSON") + + cmd = "%s -n 1 -t 1 -y -b int,x" % binPath + ret = os.system("%s" % cmd) + if ret == 0: + tdLog.exit(f"expect failed, but successful cmd= {cmd} ") + tdLog.info(f"test except ok, cmd={cmd} ret={ret}") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/csv/TD-31490.csv b/tests/army/tools/benchmark/basic/csv/TD-31490.csv new file mode 100644 index 0000000000..0027535fd5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/TD-31490.csv @@ -0,0 +1,50 @@ +0,300.18991105956627 +800,301.17345392774644 +1200,301.55375211473387 +1600,302.36356862640656 +2000,303.1406323751084 +2800,303.9159543118504 +3600,304.483725379133 +4000,305.05543735790496 +4400,305.3220278809733 +5600,306.5161529126947 +6000,307.39147847940967 +6400,308.3087978607504 +6800,309.15934507811176 +7200,309.2209920259603 +7600,309.803587911068 +8400,310.5335562951462 +8800,311.48930624122 +9200,311.759662137853 +9600,311.99896141075567 +10000,312.1610220373193 +10400,312.52790040358923 +11200,313.86419859052074 +11600,314.58161206236935 +12000,314.7287519381517 +12400,315.7150471030763 +12800,316.56835897615736 +13200,316.9096732936423 +14400,318.4992420459544 +14800,319.1871240892884 +15600,320.75835046846015 +16000,321.3268224700194 +16800,322.7216015334804 +17600,323.1404560641849 +18000,323.18247165088445 +18800,324.41639977875917 +20000,324.33270037314605 +20400,323.84187335783747 +20800,322.9354968771805 +21600,322.20467685333284 +22000,321.737580118744 +22400,322.1692179980207 +22800,322.4327523497001 +24000,323.9630653580819 +24400,324.90425359822837 +25200,326.1863442959756 +26000,327.02028556809154 +26400,327.71615254870494 +26800,328.6975738298687 +27200,329.26002057438444 +27600,329.92161585019835 \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/TS-5002.csv b/tests/army/tools/benchmark/basic/csv/TS-5002.csv new file mode 100644 index 0000000000..4c541eb174 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/TS-5002.csv @@ -0,0 +1,103 @@ +"100000000001",1,200,630,"A07","1","100000000001","100000000001U","100000000001U","A07","100000000001","100000000001","13141" +"100000000001.001",1,200,630,"A07","0","100000000001","100000000001.001U","100000000001.001U","A07","100000000001","100000000001","13141" +"100000000001.002",1,200,630,"A07","0","100000000001","100000000001.002U","100000000001.002U","A07","100000000001","100000000001","13141" +"100000000001.003",1,200,630,"A07","0","100000000001","100000000001.003U","100000000001.003U","A07","100000000001","100000000001","13141" +"100000000001.004",1,200,630,"A07","0","100000000001","100000000001.004U","100000000001.004U","A07","100000000001","100000000001","13141" +"100000000001.005",1,200,630,"A07","0","100000000001","100000000001.005U","100000000001.005U","A07","100000000001","100000000001","13141" +"100000000001.006",1,200,630,"A07","0","100000000001","100000000001.006U","100000000001.006U","A07","100000000001","100000000001","13141" +"100000000001.007",1,200,630,"A07","0","100000000001","100000000001.007U","100000000001.007U","A07","100000000001","100000000001","13141" +"100000000001.008",1,200,630,"A07","0","100000000001","100000000001.008U","100000000001.008U","A07","100000000001","100000000001","13141" +"100000000001.009",1,200,630,"A07","0","100000000001","100000000001.009U","100000000001.009U","A07","100000000001","100000000001","13141" +"100000000001.010",1,200,630,"A07","0","100000000001","100000000001.010U","100000000001.010U","A07","100000000001","100000000001","13141" +"100000000001.011",1,200,630,"A07","0","100000000001","100000000001.011U","100000000001.011U","A07","100000000001","100000000001","13141" +"100000000001.012",1,200,630,"A07","0","100000000001","100000000001.012U","100000000001.012U","A07","100000000001","100000000001","13141" +"100000000001.013",1,200,630,"A07","0","100000000001","100000000001.013U","100000000001.013U","A07","100000000001","100000000001","13141" +"100000000001.014",1,200,630,"A07","0","100000000001","100000000001.014U","100000000001.014U","A07","100000000001","100000000001","13141" +"100000000001.015",1,200,630,"A07","0","100000000001","100000000001.015U","100000000001.015U","A07","100000000001","100000000001","13141" +"100000000001.016",1,200,630,"A07","0","100000000001","100000000001.016U","100000000001.016U","A07","100000000001","100000000001","13141" +"100000000001.017",1,200,630,"A07","0","100000000001","100000000001.017U","100000000001.017U","A07","100000000001","100000000001","13141" +"100000000001.018",1,200,630,"A07","0","100000000001","100000000001.018U","100000000001.018U","A07","100000000001","100000000001","13141" +"100000000001.019",1,200,630,"A07","0","100000000001","100000000001.019U","100000000001.019U","A07","100000000001","100000000001","13141" +"100000000001.020",1,200,630,"A07","0","100000000001","100000000001.020U","100000000001.020U","A07","100000000001","100000000001","13141" +"100000000001.021",1,200,630,"A07","0","100000000001","100000000001.021U","100000000001.021U","A07","100000000001","100000000001","13141" +"100000000001.022",1,200,630,"A07","0","100000000001","100000000001.022U","100000000001.022U","A07","100000000001","100000000001","13141" +"100000000001.023",1,200,630,"A07","0","100000000001","100000000001.023U","100000000001.023U","A07","100000000001","100000000001","13141" +"100000000001.024",1,200,630,"A07","0","100000000001","100000000001.024U","100000000001.024U","A07","100000000001","100000000001","13141" +"100000000001.025",1,200,630,"A07","0","100000000001","100000000001.025U","100000000001.025U","A07","100000000001","100000000001","13141" +"100000000001.026",1,200,630,"A07","0","100000000001","100000000001.026U","100000000001.026U","A07","100000000001","100000000001","13141" +"100000000001.027",1,200,630,"A07","0","100000000001","100000000001.027U","100000000001.027U","A07","100000000001","100000000001","13141" +"100000000001.028",1,200,630,"A07","0","100000000001","100000000001.028U","100000000001.028U","A07","100000000001","100000000001","13141" +"100000000001.029",1,200,630,"A07","0","100000000001","100000000001.029U","100000000001.029U","A07","100000000001","100000000001","13141" +"100000000001.030",1,200,630,"A07","0","100000000001","100000000001.030U","100000000001.030U","A07","100000000001","100000000001","13141" +"100000000001.031",1,200,630,"A07","0","100000000001","100000000001.031U","100000000001.031U","A07","100000000001","100000000001","13141" +"100000000001.032",1,200,630,"A07","0","100000000001","100000000001.032U","100000000001.032U","A07","100000000001","100000000001","13141" +"100000000001.033",1,200,630,"A07","0","100000000001","100000000001.033U","100000000001.033U","A07","100000000001","100000000001","13141" +"100000000001.034",1,200,630,"A07","0","100000000001","100000000001.034U","100000000001.034U","A07","100000000001","100000000001","13141" +"100000000001.035",1,200,630,"A07","0","100000000001","100000000001.035U","100000000001.035U","A07","100000000001","100000000001","13141" +"100000000001.036",1,200,630,"A07","0","100000000001","100000000001.036U","100000000001.036U","A07","100000000001","100000000001","13141" +"100000000001.037",1,200,630,"A07","0","100000000001","100000000001.037U","100000000001.037U","A07","100000000001","100000000001","13141" +"100000000001.038",1,200,630,"A07","0","100000000001","100000000001.038U","100000000001.038U","A07","100000000001","100000000001","13141" +"100000000001.039",1,200,630,"A07","0","100000000001","100000000001.039U","100000000001.039U","A07","100000000001","100000000001","13141" +"100000000001.040",1,200,630,"A07","0","100000000001","100000000001.040U","100000000001.040U","A07","100000000001","100000000001","13141" +"100000000001.041",1,200,630,"A07","0","100000000001","100000000001.041U","100000000001.041U","A07","100000000001","100000000001","13141" +"100000000001.042",1,200,630,"A07","0","100000000001","100000000001.042U","100000000001.042U","A07","100000000001","100000000001","13141" +"100000000001.043",1,200,630,"A07","0","100000000001","100000000001.043U","100000000001.043U","A07","100000000001","100000000001","13141" +"100000000001.044",1,200,630,"A07","0","100000000001","100000000001.044U","100000000001.044U","A07","100000000001","100000000001","13141" +"100000000001.045",1,200,630,"A07","0","100000000001","100000000001.045U","100000000001.045U","A07","100000000001","100000000001","13141" +"100000000001.046",1,200,630,"A07","0","100000000001","100000000001.046U","100000000001.046U","A07","100000000001","100000000001","13141" +"100000000001.047",1,200,630,"A07","0","100000000001","100000000001.047U","100000000001.047U","A07","100000000001","100000000001","13141" +"100000000001.048",1,200,630,"A07","0","100000000001","100000000001.048U","100000000001.048U","A07","100000000001","100000000001","13141" +"100000000001.049",1,200,630,"A07","0","100000000001","100000000001.049U","100000000001.049U","A07","100000000001","100000000001","13141" +"100000000001.050",1,200,630,"A07","0","100000000001","100000000001.050U","100000000001.050U","A07","100000000001","100000000001","13141" +"100000000001.051",1,200,630,"A07","0","100000000001","100000000001.051U","100000000001.051U","A07","100000000001","100000000001","13141" +"100000000001.052",1,200,630,"A07","0","100000000001","100000000001.052U","100000000001.052U","A07","100000000001","100000000001","13141" +"100000000001.053",1,200,630,"A07","0","100000000001","100000000001.053U","100000000001.053U","A07","100000000001","100000000001","13141" +"100000000001.054",1,200,630,"A07","0","100000000001","100000000001.054U","100000000001.054U","A07","100000000001","100000000001","13141" +"100000000001.055",1,200,630,"A07","0","100000000001","100000000001.055U","100000000001.055U","A07","100000000001","100000000001","13141" +"100000000001.056",1,200,630,"A07","0","100000000001","100000000001.056U","100000000001.056U","A07","100000000001","100000000001","13141" +"100000000001.057",1,200,630,"A07","0","100000000001","100000000001.057U","100000000001.057U","A07","100000000001","100000000001","13141" +"100000000001.058",1,200,630,"A07","0","100000000001","100000000001.058U","100000000001.058U","A07","100000000001","100000000001","13141" +"100000000001.059",1,200,630,"A07","0","100000000001","100000000001.059U","100000000001.059U","A07","100000000001","100000000001","13141" +"100000000001.060",1,200,630,"A07","0","100000000001","100000000001.060U","100000000001.060U","A07","100000000001","100000000001","13141" +"100000000001.061",1,200,630,"A07","0","100000000001","100000000001.061U","100000000001.061U","A07","100000000001","100000000001","13141" +"100000000001.062",1,200,630,"A07","0","100000000001","100000000001.062U","100000000001.062U","A07","100000000001","100000000001","13141" +"100000000001.063",1,200,630,"A07","0","100000000001","100000000001.063U","100000000001.063U","A07","100000000001","100000000001","13141" +"100000000001.064",1,200,630,"A07","0","100000000001","100000000001.064U","100000000001.064U","A07","100000000001","100000000001","13141" +"100000000001.065",1,200,630,"A07","0","100000000001","100000000001.065U","100000000001.065U","A07","100000000001","100000000001","13141" +"100000000001.066",1,200,630,"A07","0","100000000001","100000000001.066U","100000000001.066U","A07","100000000001","100000000001","13141" +"100000000001.067",1,200,630,"A07","0","100000000001","100000000001.067U","100000000001.067U","A07","100000000001","100000000001","13141" +"100000000001.068",1,200,630,"A07","0","100000000001","100000000001.068U","100000000001.068U","A07","100000000001","100000000001","13141" +"100000000001.069",1,200,630,"A07","0","100000000001","100000000001.069U","100000000001.069U","A07","100000000001","100000000001","13141" +"100000000001.070",1,200,630,"A07","0","100000000001","100000000001.070U","100000000001.070U","A07","100000000001","100000000001","13141" +"100000000001.071",1,200,630,"A07","0","100000000001","100000000001.071U","100000000001.071U","A07","100000000001","100000000001","13141" +"100000000001.072",1,200,630,"A07","0","100000000001","100000000001.072U","100000000001.072U","A07","100000000001","100000000001","13141" +"100000000001.073",1,200,630,"A07","0","100000000001","100000000001.073U","100000000001.073U","A07","100000000001","100000000001","13141" +"100000000001.074",1,200,630,"A07","0","100000000001","100000000001.074U","100000000001.074U","A07","100000000001","100000000001","13141" +"100000000001.075",1,200,630,"A07","0","100000000001","100000000001.075U","100000000001.075U","A07","100000000001","100000000001","13141" +"100000000001.076",1,200,630,"A07","0","100000000001","100000000001.076U","100000000001.076U","A07","100000000001","100000000001","13141" +"100000000001.077",1,200,630,"A07","0","100000000001","100000000001.077U","100000000001.077U","A07","100000000001","100000000001","13141" +"100000000001.078",1,200,630,"A07","0","100000000001","100000000001.078U","100000000001.078U","A07","100000000001","100000000001","13141" +"100000000001.079",1,200,630,"A07","0","100000000001","100000000001.079U","100000000001.079U","A07","100000000001","100000000001","13141" +"100000000001.080",1,200,630,"A07","0","100000000001","100000000001.080U","100000000001.080U","A07","100000000001","100000000001","13141" +"100000000001.081",1,200,630,"A07","0","100000000001","100000000001.081U","100000000001.081U","A07","100000000001","100000000001","13141" +"100000000001.082",1,200,630,"A07","0","100000000001","100000000001.082U","100000000001.082U","A07","100000000001","100000000001","13141" +"100000000001.083",1,200,630,"A07","0","100000000001","100000000001.083U","100000000001.083U","A07","100000000001","100000000001","13141" +"100000000001.084",1,200,630,"A07","0","100000000001","100000000001.084U","100000000001.084U","A07","100000000001","100000000001","13141" +"100000000001.085",1,200,630,"A07","0","100000000001","100000000001.085U","100000000001.085U","A07","100000000001","100000000001","13141" +"100000000001.086",1,200,630,"A07","0","100000000001","100000000001.086U","100000000001.086U","A07","100000000001","100000000001","13141" +"100000000001.087",1,200,630,"A07","0","100000000001","100000000001.087U","100000000001.087U","A07","100000000001","100000000001","13141" +"100000000001.088",1,200,630,"A07","0","100000000001","100000000001.088U","100000000001.088U","A07","100000000001","100000000001","13141" +"100000000001.089",1,200,630,"A07","0","100000000001","100000000001.089U","100000000001.089U","A07","100000000001","100000000001","13141" +"100000000001.090",1,200,630,"A07","0","100000000001","100000000001.090U","100000000001.090U","A07","100000000001","100000000001","13141" +"100000000001.091",1,200,630,"A07","0","100000000001","100000000001.091U","100000000001.091U","A07","100000000001","100000000001","13141" +"100000000001.092",1,200,630,"A07","0","100000000001","100000000001.092U","100000000001.092U","A07","100000000001","100000000001","13141" +"100000000001.093",1,200,630,"A07","0","100000000001","100000000001.093U","100000000001.093U","A07","100000000001","100000000001","13141" +"100000000001.094",1,200,630,"A07","0","100000000001","100000000001.094U","100000000001.094U","A07","100000000001","100000000001","13141" +"100000000001.095",1,200,630,"A07","0","100000000001","100000000001.095U","100000000001.095U","A07","100000000001","100000000001","13141" +"100000000001.096",1,200,630,"A07","0","100000000001","100000000001.096U","100000000001.096U","A07","100000000001","100000000001","13141" +"100000000001.097",1,200,630,"A07","0","100000000001","100000000001.097U","100000000001.097U","A07","100000000001","100000000001","13141" +"100000000001.098",1,200,630,"A07","0","100000000001","100000000001.098U","100000000001.098U","A07","100000000001","100000000001","13141" +"100000000001.099",1,200,630,"A07","0","100000000001","100000000001.099U","100000000001.099U","A07","100000000001","100000000001","13141" +"100000000001.100",1,200,630,"A07","0","100000000001","100000000001.100U","100000000001.100U","A07","100000000001","100000000001","13141" +"100000000002",1,200,630,"A07","1","100000000002","100000000002U","100000000002U","A07","100000000002","100000000002","13169" +"100000000002.001",1,200,630,"A07","0","100000000002","100000000002.001U","100000000002.001U","A07","100000000002","100000000002","13169" \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/d0.csv b/tests/army/tools/benchmark/basic/csv/d0.csv new file mode 100644 index 0000000000..1f4eecd636 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/d0.csv @@ -0,0 +1,200 @@ +"2023-11-15 06:13:20.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:13:21.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:13:22.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:13:23.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:13:24.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:13:25.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:13:26.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:13:27.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:13:28.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:13:29.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:13:30.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:13:31.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:13:32.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:13:33.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:13:34.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:13:35.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:13:36.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:13:37.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:13:38.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:13:39.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:13:40.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:13:41.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:13:42.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:13:43.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:13:44.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:13:45.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:13:46.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:13:47.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:13:48.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:13:49.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:13:50.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:13:51.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:13:52.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:13:53.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:13:54.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:13:55.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:13:56.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:13:57.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:13:58.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:13:59.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:00.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:01.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:02.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:03.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:04.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:05.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:06.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:07.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:08.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:09.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:10.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:11.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:12.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:13.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:14.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:15.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:16.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:17.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:18.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:19.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:20.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:21.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:22.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:23.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:24.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:25.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:26.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:27.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:28.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:29.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:30.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:31.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:32.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:33.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:34.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:35.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:36.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:37.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:38.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:39.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:40.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:41.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:42.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:43.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:44.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:45.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:46.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:47.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:48.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:49.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:14:50.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:14:51.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:14:52.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:14:53.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:14:54.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:14:55.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:14:56.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:14:57.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:14:58.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:14:59.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:00.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:01.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:02.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:03.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:04.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:05.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:06.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:07.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:08.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:09.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:10.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:11.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:12.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:13.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:14.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:15.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:16.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:17.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:18.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:19.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:20.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:21.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:22.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:23.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:24.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:25.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:26.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:27.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:28.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:29.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:30.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:31.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:32.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:33.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:34.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:35.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:36.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:37.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:38.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:39.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:40.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:41.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:42.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:43.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:44.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:45.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:46.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:47.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:48.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:49.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:15:50.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:15:51.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:15:52.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:15:53.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:15:54.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:15:55.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:15:56.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:15:57.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:15:58.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:15:59.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:16:00.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:16:01.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:16:02.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:16:03.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:16:04.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:16:05.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:16:06.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:16:07.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:16:08.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:16:09.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:16:10.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:16:11.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:16:12.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:16:13.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:16:14.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:16:15.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:16:16.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:16:17.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:16:18.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:16:19.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:16:20.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:16:21.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:16:22.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:16:23.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:16:24.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:16:25.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:16:26.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:16:27.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:16:28.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:16:29.000", 11.9480000,216, 0.7197460 +"2023-11-15 06:16:30.000", 11.1370001,216, 0.2763700 +"2023-11-15 06:16:31.000", 8.8470001,215, 0.5411610 +"2023-11-15 06:16:32.000", 8.4510002,215, 0.7852990 +"2023-11-15 06:16:33.000", 9.1129999,218, 0.4466600 +"2023-11-15 06:16:34.000", 10.9060001,222, 0.1409650 +"2023-11-15 06:16:35.000", 8.1940002,217, 0.1292390 +"2023-11-15 06:16:36.000", 8.2639999,223, 0.5075400 +"2023-11-15 06:16:37.000", 10.1599998,223, 0.0787010 +"2023-11-15 06:16:38.000", 9.5030003,219, 0.7912880 +"2023-11-15 06:16:39.000", 11.9480000,216, 0.7197460 \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/insert-json-csv.csv b/tests/army/tools/benchmark/basic/csv/insert-json-csv.csv new file mode 100644 index 0000000000..d4138798e3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/insert-json-csv.csv @@ -0,0 +1,10 @@ +0,0,'TAOSdata-0' +1,1,'TAOSdata-1' +2,22,'TAOSdata-2' +3,333,'TAOSdata-3' +4,4444,'TAOSdata-4' +5,55555,'TAOSdata-5' +6,666666,'TAOSdata-6' +7,7777777,'TAOSdata-7' +8,88888888,'TAOSdata-8' +9,999999999,'TAOSdata-9' \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/nano_samples.csv b/tests/army/tools/benchmark/basic/csv/nano_samples.csv new file mode 100644 index 0000000000..5fc779b41b --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/nano_samples.csv @@ -0,0 +1,100 @@ +8.855,"binary_str0" ,1626870128248246976 +8.75,"binary_str1" ,1626870128249060032 +5.44,"binary_str2" ,1626870128249067968 +8.45,"binary_str3" ,1626870128249072064 +4.07,"binary_str4" ,1626870128249075904 +6.97,"binary_str5" ,1626870128249078976 +6.86,"binary_str6" ,1626870128249082048 +1.585,"binary_str7" ,1626870128249085120 +1.4,"binary_str8" ,1626870128249087936 +5.135,"binary_str9" ,1626870128249092032 +3.15,"binary_str10" ,1626870128249095104 +1.765,"binary_str11" ,1626870128249097920 +7.71,"binary_str12" ,1626870128249100992 +3.91,"binary_str13" ,1626870128249104064 +5.615,"binary_str14" ,1626870128249106880 +9.495,"binary_str15" ,1626870128249109952 +3.825,"binary_str16" ,1626870128249113024 +1.94,"binary_str17" ,1626870128249117120 +5.385,"binary_str18" ,1626870128249119936 +7.075,"binary_str19" ,1626870128249123008 +5.715,"binary_str20" ,1626870128249126080 +1.83,"binary_str21" ,1626870128249128896 +6.365,"binary_str22" ,1626870128249131968 +6.55,"binary_str23" ,1626870128249135040 +6.315,"binary_str24" ,1626870128249138112 +3.82,"binary_str25" ,1626870128249140928 +2.455,"binary_str26" ,1626870128249145024 +7.795,"binary_str27" ,1626870128249148096 +2.47,"binary_str28" ,1626870128249150912 +1.37,"binary_str29" ,1626870128249155008 +5.39,"binary_str30" ,1626870128249158080 +5.13,"binary_str31" ,1626870128249160896 +4.09,"binary_str32" ,1626870128249163968 +5.855,"binary_str33" ,1626870128249167040 +0.17,"binary_str34" ,1626870128249170112 +1.955,"binary_str35" ,1626870128249173952 +0.585,"binary_str36" ,1626870128249178048 +0.33,"binary_str37" ,1626870128249181120 +7.925,"binary_str38" ,1626870128249183936 +9.685,"binary_str39" ,1626870128249187008 +2.6,"binary_str40" ,1626870128249191104 +5.705,"binary_str41" ,1626870128249193920 +3.965,"binary_str42" ,1626870128249196992 +4.43,"binary_str43" ,1626870128249200064 +8.73,"binary_str44" ,1626870128249202880 +3.105,"binary_str45" ,1626870128249205952 +9.39,"binary_str46" ,1626870128249209024 +2.825,"binary_str47" ,1626870128249212096 +9.675,"binary_str48" ,1626870128249214912 +9.99,"binary_str49" ,1626870128249217984 +4.51,"binary_str50" ,1626870128249221056 +4.94,"binary_str51" ,1626870128249223872 +7.72,"binary_str52" ,1626870128249226944 +4.135,"binary_str53" ,1626870128249231040 +2.325,"binary_str54" ,1626870128249234112 +4.585,"binary_str55" ,1626870128249236928 +8.76,"binary_str56" ,1626870128249240000 +4.715,"binary_str57" ,1626870128249243072 +0.56,"binary_str58" ,1626870128249245888 +5.35,"binary_str59" ,1626870128249249984 +5.075,"binary_str60" ,1626870128249253056 +6.665,"binary_str61" ,1626870128249256128 +7.13,"binary_str62" ,1626870128249258944 +2.775,"binary_str63" ,1626870128249262016 +5.775,"binary_str64" ,1626870128249265088 +1.62,"binary_str65" ,1626870128249267904 +1.625,"binary_str66" ,1626870128249270976 +8.15,"binary_str67" ,1626870128249274048 +0.75,"binary_str68" ,1626870128249277120 +3.265,"binary_str69" ,1626870128249280960 +8.585,"binary_str70" ,1626870128249284032 +1.88,"binary_str71" ,1626870128249287104 +8.44,"binary_str72" ,1626870128249289920 +5.12,"binary_str73" ,1626870128249295040 +2.58,"binary_str74" ,1626870128249298112 +9.42,"binary_str75" ,1626870128249300928 +1.765,"binary_str76" ,1626870128249304000 +2.66,"binary_str77" ,1626870128249308096 +1.405,"binary_str78" ,1626870128249310912 +5.595,"binary_str79" ,1626870128249315008 +2.28,"binary_str80" ,1626870128249318080 +9.24,"binary_str81" ,1626870128249320896 +9.03,"binary_str82" ,1626870128249323968 +6.055,"binary_str83" ,1626870128249327040 +1.74,"binary_str84" ,1626870128249330112 +5.77,"binary_str85" ,1626870128249332928 +1.97,"binary_str86" ,1626870128249336000 +0.3,"binary_str87" ,1626870128249339072 +7.145,"binary_str88" ,1626870128249342912 +0.88,"binary_str89" ,1626870128249345984 +8.025,"binary_str90" ,1626870128249349056 +4.81,"binary_str91" ,1626870128249351872 +0.725,"binary_str92" ,1626870128249355968 +3.85,"binary_str93" ,1626870128249359040 +9.455,"binary_str94" ,1626870128249362112 +2.265,"binary_str95" ,1626870128249364928 +3.985,"binary_str96" ,1626870128249368000 +9.375,"binary_str97" ,1626870128249371072 +0.2,"binary_str98" ,1626870128249373888 +6.95,"binary_str99" ,1626870128249377984 diff --git a/tests/army/tools/benchmark/basic/csv/nano_sampletags.csv b/tests/army/tools/benchmark/basic/csv/nano_sampletags.csv new file mode 100644 index 0000000000..18fb855d6d --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/nano_sampletags.csv @@ -0,0 +1,100 @@ +"string0",7,8.615 +"string1",4,9.895 +"string2",3,2.92 +"string3",3,5.62 +"string4",7,1.615 +"string5",6,1.45 +"string6",5,7.48 +"string7",7,3.01 +"string8",5,4.76 +"string9",10,7.09 +"string10",2,8.38 +"string11",7,8.65 +"string12",5,5.025 +"string13",10,5.765 +"string14",2,4.57 +"string15",2,1.03 +"string16",7,6.98 +"string17",10,0.23 +"string18",7,5.815 +"string19",1,2.37 +"string20",10,8.865 +"string21",3,1.235 +"string22",2,8.62 +"string23",9,1.045 +"string24",8,4.34 +"string25",1,5.455 +"string26",2,4.475 +"string27",1,6.95 +"string28",2,3.39 +"string29",3,6.79 +"string30",7,9.735 +"string31",1,9.79 +"string32",10,9.955 +"string33",1,5.095 +"string34",3,3.86 +"string35",9,5.105 +"string36",10,4.22 +"string37",1,2.78 +"string38",9,6.345 +"string39",1,0.975 +"string40",5,6.16 +"string41",4,7.735 +"string42",5,6.6 +"string43",8,2.845 +"string44",1,0.655 +"string45",3,2.995 +"string46",9,3.6 +"string47",8,3.47 +"string48",3,7.98 +"string49",6,2.225 +"string50",9,5.44 +"string51",4,6.335 +"string52",3,2.955 +"string53",1,0.565 +"string54",6,5.575 +"string55",6,9.905 +"string56",9,6.025 +"string57",8,0.94 +"string58",10,0.15 +"string59",8,1.555 +"string60",4,2.28 +"string61",2,8.29 +"string62",9,6.22 +"string63",6,3.35 +"string64",10,6.7 +"string65",3,9.345 +"string66",7,9.815 +"string67",1,5.365 +"string68",10,3.81 +"string69",1,6.405 +"string70",8,2.715 +"string71",3,8.58 +"string72",8,6.34 +"string73",2,7.49 +"string74",4,8.64 +"string75",3,8.995 +"string76",7,3.465 +"string77",1,7.64 +"string78",6,3.65 +"string79",6,1.4 +"string80",6,5.875 +"string81",2,1.22 +"string82",5,7.87 +"string83",9,8.41 +"string84",9,8.9 +"string85",9,3.89 +"string86",2,5.0 +"string87",2,4.495 +"string88",4,2.835 +"string89",3,5.895 +"string90",7,8.41 +"string91",5,5.125 +"string92",7,9.165 +"string93",5,8.315 +"string94",10,7.485 +"string95",7,4.635 +"string96",2,6.015 +"string97",8,0.595 +"string98",3,8.79 +"string99",4,1.72 diff --git a/tests/army/tools/benchmark/basic/csv/sample.csv b/tests/army/tools/benchmark/basic/csv/sample.csv new file mode 100644 index 0000000000..471118a2ce --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample.csv @@ -0,0 +1,3 @@ +1,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','true' +0,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','true' +0,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','false' \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/sample_no_ts.csv b/tests/army/tools/benchmark/basic/csv/sample_no_ts.csv new file mode 100644 index 0000000000..3fa803186c --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_no_ts.csv @@ -0,0 +1,4 @@ +1 +2 +3 +NULL diff --git a/tests/army/tools/benchmark/basic/csv/sample_tags.csv b/tests/army/tools/benchmark/basic/csv/sample_tags.csv new file mode 100644 index 0000000000..59e6ace4e4 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_tags.csv @@ -0,0 +1,2 @@ +17 +NULL diff --git a/tests/army/tools/benchmark/basic/csv/sample_ts.csv b/tests/army/tools/benchmark/basic/csv/sample_ts.csv new file mode 100644 index 0000000000..53948c3d2a --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_ts.csv @@ -0,0 +1,4 @@ +'2021-10-28 15:34:44.735',1,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','true' +'2021-10-29 15:34:44.735',2,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','true' +'2021-10-30 15:34:44.735',3,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','false' +1635665684735,4,-1,2147483647,0,2247483647.1,-12.2,'12ac,;\[uer]','23ac,;\[uer23423]123123','false' \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/csv/sample_ts_stmt_tags.csv b/tests/army/tools/benchmark/basic/csv/sample_ts_stmt_tags.csv new file mode 100644 index 0000000000..89bf8e3fb3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_ts_stmt_tags.csv @@ -0,0 +1,2 @@ +1,-127,127,'23ac,;\[uer]3','true' +1,-127,126,'23ac,;\[uer]3','true' diff --git a/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb3.csv b/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb3.csv new file mode 100644 index 0000000000..a91a705de8 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb3.csv @@ -0,0 +1,4 @@ +1641976781445,300 +1641976781446,600 +1641976781447,900 +1641976781448,NULL diff --git a/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb5.csv b/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb5.csv new file mode 100644 index 0000000000..f3c5949ced --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_use_ts-stb5.csv @@ -0,0 +1,4 @@ +1641976781445,500 +1641976781446,1000 +1641976781447,1500 +1641976781448,NULL diff --git a/tests/army/tools/benchmark/basic/csv/sample_use_ts.csv b/tests/army/tools/benchmark/basic/csv/sample_use_ts.csv new file mode 100644 index 0000000000..3cecfe542e --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/sample_use_ts.csv @@ -0,0 +1,4 @@ +1641976781445,1 +1641976781446,2 +1641976781447,3 +1641976781448,NULL diff --git a/tests/army/tools/benchmark/basic/csv/tags.csv b/tests/army/tools/benchmark/basic/csv/tags.csv new file mode 100644 index 0000000000..89bf8e3fb3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/csv/tags.csv @@ -0,0 +1,2 @@ +1,-127,127,'23ac,;\[uer]3','true' +1,-127,126,'23ac,;\[uer]3','true' diff --git a/tests/army/tools/benchmark/basic/custom_col_tag.py b/tests/army/tools/benchmark/basic/custom_col_tag.py new file mode 100644 index 0000000000..5e325aa845 --- /dev/null +++ b/tests/army/tools/benchmark/basic/custom_col_tag.py @@ -0,0 +1,91 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-13928] taosBenchmark improve user interface + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/custom_col_tag.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkData(0, 0, "ts") + tdSql.checkData(1, 0, "first_col") + tdSql.checkData(2, 0, "second_col") + tdSql.checkData(3, 0, "second_col_1") + tdSql.checkData(4, 0, "second_col_2") + tdSql.checkData(5, 0, "second_col_3") + tdSql.checkData(6, 0, "second_col_4") + tdSql.checkData(7, 0, "third_col") + tdSql.checkData(8, 0, "forth_col") + tdSql.checkData(9, 0, "forth_col_1") + tdSql.checkData(10, 0, "forth_col_2") + tdSql.checkData(11, 0, "single") + tdSql.checkData(12, 0, "multiple") + tdSql.checkData(13, 0, "multiple_1") + tdSql.checkData(14, 0, "multiple_2") + tdSql.checkData(15, 0, "multiple_3") + tdSql.checkData(16, 0, "multiple_4") + tdSql.checkData(17, 0, "thensingle") + tdSql.checkData(18, 0, "thenmultiple") + tdSql.checkData(19, 0, "thenmultiple_1") + tdSql.checkData(20, 0, "thenmultiple_2") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/default_json.py b/tests/army/tools/benchmark/basic/default_json.py new file mode 100644 index 0000000000..86567f40da --- /dev/null +++ b/tests/army/tools/benchmark/basic/default_json.py @@ -0,0 +1,73 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(10) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 100) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/default_tmq_json.py b/tests/army/tools/benchmark/basic/default_tmq_json.py new file mode 100644 index 0000000000..f3b0dc0c48 --- /dev/null +++ b/tests/army/tools/benchmark/basic/default_tmq_json.py @@ -0,0 +1,91 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +# import os, signal +import os +from time import sleep +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.execute("drop topic if exists topic_0") + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + + tdSql.execute("alter database db WAL_RETENTION_PERIOD 3600000") + + cmd = "%s -f ./taosbenchmark/json/tmq.json " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + sleep(15) + + # try: + # for line in os.popen("ps ax | grep taosBenchmark | grep -v grep"): + # fields = line.split() + + # pid = fields[0] + + # os.kill(int(pid), signal.SIGINT) + # time.sleep(3) + # print("taosBenchmark be killed on purpose") + # except: + # tdLog.exit("failed to kill taosBenchmark") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/demo.py b/tests/army/tools/benchmark/basic/demo.py new file mode 100644 index 0000000000..d842d249c7 --- /dev/null +++ b/tests/army/tools/benchmark/basic/demo.py @@ -0,0 +1,100 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-13823] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -n 100 -t 100 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 10000) + + tdSql.query("describe meters") + tdSql.checkRows(6) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(0, 0, "ts") + tdSql.checkData(1, 0, "current") + tdSql.checkData(1, 1, "FLOAT") + tdSql.checkData(2, 0, "voltage") + tdSql.checkData(2, 1, "INT") + tdSql.checkData(3, 0, "phase") + tdSql.checkData(3, 1, "FLOAT") + tdSql.checkData(4, 0, "groupid") + tdSql.checkData(4, 1, "INT") + tdSql.checkData(4, 3, "TAG") + tdSql.checkData(5, 0, "location") + # binary for 2.x and varchar for 3.x + # tdSql.checkData(5, 1, "BINARY") + tdSql.checkData(5, 2, 24) + tdSql.checkData(5, 3, "TAG") + + tdSql.query("select count(*) from test.meters where groupid >= 0") + tdSql.checkData(0, 0, 10000) + + tdSql.query( + "select count(*) from test.meters where location = 'California.SanFrancisco' or location = 'California.LosAngles' or location = 'California.SanDiego' or location = 'California.SanJose' or \ + location = 'California.PaloAlto' or location = 'California.Campbell' or location = 'California.MountainView' or location = 'California.Sunnyvale' or location = 'California.SantaClara' or location = 'California.Cupertino' " + ) + tdSql.checkData(0, 0, 10000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/exportCsv.py b/tests/army/tools/benchmark/basic/exportCsv.py new file mode 100644 index 0000000000..6659c4a606 --- /dev/null +++ b/tests/army/tools/benchmark/basic/exportCsv.py @@ -0,0 +1,147 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import json +import csv + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +# reomve single and double quotation +def removeQuotation(origin): + value = "" + for c in origin: + if c != '\'' and c != '"': + value += c + + return value + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + # check correct + def checkCorrect(self, csvFile, allRows, interlaceRows): + # open as csv + count = 0 + batch = 0 + name = "" + with open(csvFile) as file: + rows = csv.reader(file) + for row in rows: + # interlaceRows + if name == "": + name = row[0] + batch = 1 + else: + if name == row[0]: + batch += 1 + else: + # switch to another child table + if batch != interlaceRows: + tdLog.exit(f"interlaceRows invalid. tbName={name} real={batch} expect={interlaceRows} i={count} csvFile={csvFile}") + batch = 1 + name = row[0] + # count ++ + count += 1 + # batch + if batch != interlaceRows: + tdLog.exit(f"interlaceRows invalid. tbName={name} real={batch} expect={interlaceRows} i={count} csvFile={csvFile}") + + # check all rows + if count != allRows: + tdLog.exit(f"allRows invalid. real={count} expect={allRows} csvFile={csvFile}") + + tdLog.info(f"Check generate csv file successfully. csvFile={csvFile} count={count} interlaceRows={batch}") + + # check result + def checResult(self, jsonFile): + # csv + with open(jsonFile) as file: + data = json.load(file) + + # read json + database = data["databases"][0] + out = data["csvPath"] + dbName = database["dbinfo"]["name"] + stables = database["super_tables"] + for stable in stables: + stbName = stable["name"] + childs = stable["childtable_count"] + insertRows = stable["insert_rows"] + interlaceRows = stable["interlace_rows"] + csvFile = f"{out}{dbName}-{stbName}.csv" + rows = childs * insertRows + if interlaceRows == 0: + interlaceRows = insertRows + # check csv context correct + self.checkCorrect(csvFile, rows, interlaceRows) + + def checkExportCsv(self, benchmark, jsonFile, options=""): + # exec + cmd = f"{benchmark} {options} -f {jsonFile}" + os.system(cmd) + + # check result + self.checResult(jsonFile) + + def run(self): + # path + benchmark = self.getPath() + + # do check + json = "taosbenchmark/json/exportCsv.json" + self.checkExportCsv(benchmark, json) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/from-to-continue.py b/tests/army/tools/benchmark/basic/from-to-continue.py new file mode 100644 index 0000000000..8503833982 --- /dev/null +++ b/tests/army/tools/benchmark/basic/from-to-continue.py @@ -0,0 +1,101 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-20424] taosBenchmark insert child table from and to test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -t 6 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-no.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 6 + 3) + + binPath = self.getPath() + cmd = "%s -t 5 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.execute("create table d5 using meters tags (4, 'd5')") + + cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-yes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 5 + 3) + + binPath = self.getPath() + cmd = "%s -t 4 -n 1 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("use test") + tdSql.execute("create table d4 using meters tags (4, 'd4')") + + cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-smart.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 4 + 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/from-to.py b/tests/army/tools/benchmark/basic/from-to.py new file mode 100644 index 0000000000..b67db54670 --- /dev/null +++ b/tests/army/tools/benchmark/basic/from-to.py @@ -0,0 +1,86 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-22157] taosBenchmark insert child table from and to test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/from-to.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 50) + + if major_ver == "3": + for i in range(0, 5): + tdSql.error("select count(*) from db.d%d" % i) + else: + for i in range(0, 5): + tdSql.error("select count(*) from db.d%d" % i) + for i in range(5, 10): + tdSql.query("select count(*) from db.d%d" % i) + tdSql.checkData(0, 0, 10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/insert-json-csv.py b/tests/army/tools/benchmark/basic/insert-json-csv.py new file mode 100644 index 0000000000..ec65fe50bd --- /dev/null +++ b/tests/army/tools/benchmark/basic/insert-json-csv.py @@ -0,0 +1,89 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import time +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + now = time.time() + self.ts = int(round(now * 1000)) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath("taosBenchmark") + if binPath == "": + tdLog.exit("taosBenchmark not found!") + else: + tdLog.info("taosBenchmark found in %s" % binPath) + + # insert: create one or multiple tables per sql and insert multiple rows per sql + # test case for https://jira.taosdata.com:18080/browse/TD-4985 + os.system("%s -f ./taosbenchmark/json/insert-json-csv.json -y " % binPath) + + tdSql.execute("use db") + if major_ver == "3": + tdSql.query("select count(*) from (select distinct(tbname) from stb0)") + else: + tdSql.query("select count(tbname) from stb0") + tdSql.checkData(0, 0, 1) + + tdSql.query("select * from stb0 where tbname like 'stb00_0' limit 10") + tdSql.checkData(0, 1, 0) + tdSql.checkData(1, 1, 1) + tdSql.checkData(2, 1, 2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/invalid_commandline.py b/tests/army/tools/benchmark/basic/invalid_commandline.py new file mode 100644 index 0000000000..466c606753 --- /dev/null +++ b/tests/army/tools/benchmark/basic/invalid_commandline.py @@ -0,0 +1,93 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -F abc -P abc -I abc -T abc -i abc -S abc -B abc -r abc -t abc -n abc -l abc -w abc -w 16385 -R abc -O abc -a abc -n 2 -t 2 -r 1 -y" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 4) + + cmd = "%s non_exist_opt" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + cmd = "%s -f non_exist_file -y" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + cmd = "%s -h non_exist_host -y" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + cmd = "%s -p non_exist_pass -y" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + cmd = "%s -u non_exist_user -y" % binPath + tdLog.info("%s" % cmd) + assert os.system("%s" % cmd) != 0 + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/json/TD-31490.json b/tests/army/tools/benchmark/basic/json/TD-31490.json new file mode 100644 index 0000000000..7d01963722 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-31490.json @@ -0,0 +1,63 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 1, + "thread_count": 1, + "create_table_thread_count": 1, + "result_file": "./res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 1 , + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "zh", + "drop": "yes", + "keep": 36500, + "wal_retention_period": 0, + "buffer": 256, + "stt_trigger": 1, + "vgroups ": 1 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 1, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 300, + "data_source": "sample", + "insert_mode": "stmt", + "non_stop_mode": "no", + "insert_rows": 50, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 10, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 0, + "timestamp_step": 0, + "start_timestamp": "2020-1-1 0:0:0", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/TD-31490.csv", + "use_sample_ts": "yes", + "tags_file": "", + "columns": [ + { "type": "DOUBLE", "count": 1 } + ], + "tags": [ + { "name": "id", "type": "UINT" } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/TD-31575.json b/tests/army/tools/benchmark/basic/json/TD-31575.json new file mode 100644 index 0000000000..eaa2ea5404 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-31575.json @@ -0,0 +1,81 @@ +{ + "filetype":"insert", + "cfgdir":"/etc/taos", + "host":"127.0.0.1", + "port":6030, + "user":"root", + "password":"taosdata", + "connection_pool_size":32, + "thread_count":32, + "create_table_thread_count":10, + "confirm_parameter_prompt":"no", + "num_of_records_per_req":1000, + "thread_bind_vgroup":"yes", + "databases":[ + { + "dbinfo":{ + "name":"power", + "drop":"yes", + "replica":1, + "wal_retention_period":0, + "wal_retention_size":0, + "vgroups":4, + "cachemodel": "'none'", + "cachesize":1, + "wal_level":1, + "buffer":256, + "duration":"14400m", + "stt_trigger":1 + }, + "super_tables":[ + { + "name":"meters", + "child_table_exists":"no", + "childtable_count":100, + "childtable_prefix":"d", + "escape_character":"yes", + "auto_create_table":"no", + "batch_create_tbl_num":5, + "data_source":"rand", + "insert_mode":"stmt", + "insert_rows":320, + "interlace_rows":1, + "insert_interval":0, + "timestamp_step":1000, + "start_timestamp":"2022-10-01 00:00:00.000", + "columns":[ + { "type": "float", "name": "current", "max": 1, "min": 0 }, + { "type": "int", "name": "voltage", "max": 100, "min": 0 }, + { "type": "float", "name": "phase", "max": 100, "min": 0 } + ], + "tags":[ + { + "type":"binary", + "name":"location", + "max":64, + "min":1, + "values":[ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + }, + { + "name":"groupId", + "type":"int", + "max":100000, + "min":1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/TD-32846.json b/tests/army/tools/benchmark/basic/json/TD-32846.json new file mode 100644 index 0000000000..cd8b87e480 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-32846.json @@ -0,0 +1,82 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 20, + "thread_count": 4, + "create_table_thread_count": 8, + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 300, + "thread_bind_vgroup": "no", + "prepared_rand": 1000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [{ + "dbinfo": { + "name": "nws", + "drop": "yes", + "wal_retention_size":10, + "vgroups": 4, + "buffer": 30, + "stt_trigger": 1, + "wal_level": 0, + "precision": "ms" + }, + "super_tables": [{ + "name": "product", + "child_table_exists": "no", + "childtable_count": 9, + "childtable_prefix": "d", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt2", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 10340, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 10, + "start_timestamp": "2024-01-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{ + "type": "VARCHAR", + "name": "datakey", + "len": 32, + "values": ["Grid_0_0"] + }, { + "type": "VARCHAR", + "name": "datavalue", + "len": 32768 + }, { + "type": "TIMESTAMP", + "name": "itime" + }], + "tags": [{ + "type": "VARCHAR", + "name": "prodcode", + "values": ["AAA"] + }, { + "type": "INT", + "name": "validtime", + "max": 72, + "min": 1 + }, { + "type": "INT", + "name": "heightcount", + "max": 21, + "min": 1 + }] + }] + }] +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/TD-32913-1.json b/tests/army/tools/benchmark/basic/json/TD-32913-1.json new file mode 100644 index 0000000000..3ea8d232c0 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-32913-1.json @@ -0,0 +1,67 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "dsn": "http://127.0.0.1:6041", + "host": "127.0.0.1", + "port": "6030", + "user": "root", + "password": "taosdata", + "connection_pool_size": 100, + "thread_count": 10, + "create_table_thread_count": 3, + "result_file": "./res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 1000, + "thread_bind_vgroup": "yes", + "prepared_rand": 1000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [{ + "dbinfo": { + "name": "td32913db", + "drop": "no", + "vgroups": 4, + "precision": "ms" + }, + "super_tables": [{ + "name": "ntsp_realtime_hf", + "child_table_exists": "no", + "childtable_count": 17, + "childtable_prefix": "d", + "auto_create_table": "no", + "batch_create_tbl_num": 500, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 10, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 1000, + "start_timestamp": "2024-10-01 00:00:00.000", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{ + "type": "TIMESTAMP", + "name": "st" + }, { + "type": "VARCHAR", + "name": "data", + "len": 512 + }], + "tags": [{ + "type": "VARCHAR", + "name": "type", + "len": 2 + }, { + "type": "VARCHAR", + "name": "vin", + "len": 100 + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/TD-32913-2.json b/tests/army/tools/benchmark/basic/json/TD-32913-2.json new file mode 100644 index 0000000000..2ddf01d266 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-32913-2.json @@ -0,0 +1,67 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "dsn": "http://127.0.0.1:6041", + "host": "127.0.0.1", + "port": "6030", + "user": "root", + "password": "taosdata", + "connection_pool_size": 100, + "thread_count": 10, + "create_table_thread_count": 3, + "result_file": "./res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 1000, + "thread_bind_vgroup": "no", + "prepared_rand": 1000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [{ + "dbinfo": { + "name": "td32913db2", + "drop": "yes", + "vgroups": 4, + "precision": "ms" + }, + "super_tables": [{ + "name": "ntsp_realtime_hf", + "child_table_exists": "no", + "childtable_count": 17, + "childtable_prefix": "d", + "auto_create_table": "no", + "batch_create_tbl_num": 500, + "data_source": "rand", + "insert_mode": "stmt", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 10, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 1000, + "start_timestamp": "2024-10-01 00:00:00.000", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{ + "type": "TIMESTAMP", + "name": "st" + }, { + "type": "VARCHAR", + "name": "data", + "len": 512 + }], + "tags": [{ + "type": "VARCHAR", + "name": "type", + "len": 2 + }, { + "type": "VARCHAR", + "name": "vin", + "len": 100 + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/TD-32913-3.json b/tests/army/tools/benchmark/basic/json/TD-32913-3.json new file mode 100644 index 0000000000..5e30328d64 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-32913-3.json @@ -0,0 +1,66 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": "6030", + "user": "root", + "password": "taosdata", + "connection_pool_size": 100, + "thread_count": 10, + "create_table_thread_count": 3, + "result_file": "./res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 1000, + "thread_bind_vgroup": "yes", + "prepared_rand": 1000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [{ + "dbinfo": { + "name": "td32913db3", + "drop": "yes", + "vgroups": 2, + "precision": "ms" + }, + "super_tables": [{ + "name": "ntsp_realtime_hf", + "child_table_exists": "no", + "childtable_count": 13, + "childtable_prefix": "d", + "auto_create_table": "no", + "batch_create_tbl_num": 500, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1231, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 10, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 1000, + "start_timestamp": "2024-10-01 00:00:00.000", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{ + "type": "TIMESTAMP", + "name": "st" + }, { + "type": "VARCHAR", + "name": "data", + "len": 512 + }], + "tags": [{ + "type": "VARCHAR", + "name": "type", + "len": 2 + }, { + "type": "VARCHAR", + "name": "vin", + "len": 100 + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/TD-32913.json b/tests/army/tools/benchmark/basic/json/TD-32913.json new file mode 100644 index 0000000000..a126ec6ce7 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TD-32913.json @@ -0,0 +1,66 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": "6030", + "user": "root", + "password": "taosdata", + "connection_pool_size": 100, + "thread_count": 10, + "create_table_thread_count": 3, + "result_file": "./res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 1000, + "thread_bind_vgroup": "yes", + "prepared_rand": 1000, + "chinese": "no", + "escape_character": "yes", + "continue_if_fail": "no", + "databases": [{ + "dbinfo": { + "name": "td32913db", + "drop": "yes", + "vgroups": 2, + "precision": "ms" + }, + "super_tables": [{ + "name": "ntsp_realtime_hf", + "child_table_exists": "no", + "childtable_count": 17, + "childtable_prefix": "d", + "auto_create_table": "no", + "batch_create_tbl_num": 500, + "data_source": "rand", + "insert_mode": "stmt", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1000, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 10, + "insert_interval": 0, + "partial_col_num": 0, + "timestamp_step": 1000, + "start_timestamp": "2024-10-01 00:00:00.000", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{ + "type": "TIMESTAMP", + "name": "st" + }, { + "type": "VARCHAR", + "name": "data", + "len": 512 + }], + "tags": [{ + "type": "VARCHAR", + "name": "type", + "len": 2 + }, { + "type": "VARCHAR", + "name": "vin", + "len": 100 + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/TS-5002.json b/tests/army/tools/benchmark/basic/json/TS-5002.json new file mode 100644 index 0000000000..66e40818f0 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TS-5002.json @@ -0,0 +1,155 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 20, + "thread_count": 20, + "create_table_thread_count": 1, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "num_of_records_per_req": 5000, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "test240613", + "drop": "yes", + "replica": 1, + "wal_retention_period": 0, + "buffer": 256, + "cachemodel": "'both'", + "cachesize": 100, + "stt_trigger": 1, + "vgroups ": 3 + }, + "super_tables": [ + { + "name": "test_cj_dydlqx_03", + "child_table_exists": "no", + "childtable_count": 100, + "childtable_prefix": "dydlqx_03_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "non_stop_mode": "no", + "insert_rows": 0, + "childtable_exists": "no", + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 0, + "timestamp_step": 900000, + "start_timestamp": "2024-6-01 0:0:0", + "tags_file": "./taosbenchmark/csv/TS-5002.csv", + "columns": [ + { + "type": "FLOAT", + "name": "ady", + "max": 230, + "min": 140 + }, + { + "type": "FLOAT", + "name": "bdy", + "max": 230, + "min": 140 + }, + { + "type": "FLOAT", + "name": "cdy", + "max": 230, + "min": 140 + }, + { + "type": "FLOAT", + "name": "adl", + "max": 6, + "min": 4 + }, + { + "type": "FLOAT", + "name": "bdl", + "max": 6, + "min": 4 + }, + { + "type": "FLOAT", + "name": "cdl", + "max": 6, + "min": 4 + }, + { + "type": "FLOAT", + "name": "lxdl", + "max": 6, + "min": 4 + } + ], + "tags": [ + { + "name": "cldbs", + "type": "VARCHAR" + }, + { + "name": "pt_ratio", + "type": "FLOAT" + }, + { + "name": "ct_ratio", + "type": "FLOAT" + }, + { + "name": "rated_cap", + "type": "FLOAT" + }, + { + "name": "area_code", + "type": "VARCHAR" + }, + { + "name": "zdy_flag", + "type": "VARCHAR" + }, + { + "name": "ta_id", + "type": "VARCHAR" + }, + { + "name": "cust_no", + "type": "VARCHAR" + }, + { + "name": "elec_cust_name", + "type": "VARCHAR" + }, + { + "name": "bureau_code", + "type": "VARCHAR" + }, + { + "name": "id", + "type": "VARCHAR" + }, + { + "name": "fl_name", + "type": "VARCHAR" + }, + { + "name": "classify_id", + "type": "VARCHAR" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/TS-5234-1.json b/tests/army/tools/benchmark/basic/json/TS-5234-1.json new file mode 100644 index 0000000000..9965b94919 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TS-5234-1.json @@ -0,0 +1,78 @@ +{ + "filetype":"insert", + "cfgdir":"/etc/taos", + "host":"127.0.0.1", + "port":6030, + "user":"root", + "password":"taosdata", + "thread_count":1, + "create_table_thread_count":1, + "confirm_parameter_prompt":"no", + "num_of_records_per_req":1000, + "databases":[ + { + "dbinfo":{ + "name":"test", + "drop":"yes", + "replica":1, + "wal_retention_period":2, + "wal_retention_size":10, + "vgroups":1, + "precision": "ns", + "cachemodel": "none", + "duration":"14400m", + "cachesize":1, + "wal_level":1, + "buffer":256, + "stt_trigger":1 + }, + "super_tables":[ + { + "name":"meters", + "child_table_exists":"no", + "childtable_prefix":"d", + "escape_character":"yes", + "auto_create_table":"no", + "batch_create_tbl_num":5, + "data_source":"rand", + "insert_mode":"taosc", + "childtable_count": 4, + "insert_rows":1000, + "timestamp_step":1000, + "start_timestamp":"2022-10-01 00:00:00.000", + "columns":[ + { "type": "float", "name": "current", "max": 1, "min": 0 }, + { "type": "int", "name": "voltage", "max": 100, "min": 0 }, + { "type": "float", "name": "phase", "max": 100, "min": 0 } + ], + "tags":[ + { + "type":"binary", + "name":"location", + "max":64, + "min":1, + "values":[ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + }, + { + "name":"groupId", + "type":"int", + "max":100000, + "min":1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/TS-5234-2.json b/tests/army/tools/benchmark/basic/json/TS-5234-2.json new file mode 100644 index 0000000000..4273e44679 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TS-5234-2.json @@ -0,0 +1,78 @@ +{ + "filetype":"insert", + "cfgdir":"/etc/taos", + "host":"127.0.0.1", + "port":6030, + "user":"root", + "password":"taosdata", + "thread_count":1, + "create_table_thread_count":1, + "confirm_parameter_prompt":"no", + "num_of_records_per_req":1000, + "databases":[ + { + "dbinfo":{ + "name":"test", + "drop":"yes", + "replica":1, + "wal_retention_period":20, + "wal_retention_size":10, + "vgroups":2, + "precision": "us", + "cachemodel": "'both'", + "cachesize":1, + "wal_level":1, + "buffer":256, + "duration": 3, + "stt_trigger":1 + }, + "super_tables":[ + { + "name":"meters", + "child_table_exists":"no", + "childtable_prefix":"d", + "escape_character":"yes", + "auto_create_table":"no", + "batch_create_tbl_num":5, + "data_source":"rand", + "insert_mode":"taosc", + "childtable_count": 4, + "insert_rows":1000, + "timestamp_step":1000, + "start_timestamp":"2022-10-01 00:00:00.000", + "columns":[ + { "type": "float", "name": "current", "max": 1, "min": 0 }, + { "type": "int", "name": "voltage", "max": 100, "min": 0 }, + { "type": "float", "name": "phase", "max": 100, "min": 0 } + ], + "tags":[ + { + "type":"binary", + "name":"location", + "max":64, + "min":1, + "values":[ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + }, + { + "name":"groupId", + "type":"int", + "max":100000, + "min":1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/TS-5234-3.json b/tests/army/tools/benchmark/basic/json/TS-5234-3.json new file mode 100644 index 0000000000..95464806f3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/TS-5234-3.json @@ -0,0 +1,76 @@ +{ + "filetype":"insert", + "cfgdir":"/etc/taos", + "host":"127.0.0.1", + "port":6030, + "user":"root", + "password":"taosdata", + "thread_count":1, + "create_table_thread_count":1, + "confirm_parameter_prompt":"no", + "num_of_records_per_req":1000, + "databases":[ + { + "dbinfo":{ + "name":"test", + "drop":"yes", + "replica":1, + "wal_retention_period":20, + "wal_retention_size":10, + "vgroups":3, + "precision": "us", + "cachemodel": "\"last_value\"", + "cachesize":1, + "wal_level":1, + "buffer":256, + "stt_trigger":1 + }, + "super_tables":[ + { + "name":"meters", + "child_table_exists":"no", + "childtable_prefix":"d", + "escape_character":"yes", + "auto_create_table":"no", + "batch_create_tbl_num":5, + "data_source":"rand", + "childtable_count": 4, + "insert_rows":1000, + "timestamp_step":1000, + "start_timestamp":"2022-10-01 00:00:00.000", + "columns":[ + { "type": "float", "name": "current", "max": 1, "min": 0 }, + { "type": "int", "name": "voltage", "max": 100, "min": 0 }, + { "type": "float", "name": "phase", "max": 100, "min": 0 } + ], + "tags":[ + { + "type":"binary", + "name":"location", + "max":64, + "min":1, + "values":[ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + }, + { + "name":"groupId", + "type":"int", + "max":100000, + "min":1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/case-insert-mix1.json b/tests/army/tools/benchmark/basic/json/case-insert-mix1.json new file mode 100644 index 0000000000..b7db35c6eb --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/case-insert-mix1.json @@ -0,0 +1,76 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 100, + "thread_count": 3, + "create_table_thread_count": 1, + "result_file": "./insert_res_mix1.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "check_sql": "yes", + "continue_if_fail": "no", + "databases": [ + { + "dbinfo": { + "name": "mix1", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 1, + "insert_rows": 10000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "insert_interval": 0, + "timestamp_step": 10, + "start_timestamp":1500000000000, + "disorder_ratio": 10, + "update_ratio": 5, + "delete_ratio": 1, + "disorder_fill_interval": 50, + "update_fill_interval": 25, + "generate_row_rule": 2, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "max": 1, "min": 0 }, + { "type": "double", "name": "dc", "max": 1, "min": 0 }, + { "type": "tinyint", "name": "ti", "max": 100, "min": 0 }, + { "type": "smallint", "name": "si", "max": 100, "min": 0 }, + { "type": "int", "name": "ic", "max": 100, "min": 0 }, + { "type": "bigint", "name": "bi", "max": 100, "min": 0 }, + { "type": "utinyint", "name": "uti", "max": 100, "min": 0 }, + { "type": "usmallint", "name": "usi", "max": 100, "min": 0 }, + { "type": "uint", "name": "ui", "max": 100, "min": 0 }, + { "type": "ubigint", "name": "ubi", "max": 100, "min": 0 }, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64} + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/case-insert-mix2.json b/tests/army/tools/benchmark/basic/json/case-insert-mix2.json new file mode 100644 index 0000000000..b00fc17c07 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/case-insert-mix2.json @@ -0,0 +1,76 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 100, + "thread_count": 3, + "create_table_thread_count": 1, + "result_file": "./insert_res_mix2.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "check_sql": "yes", + "continue_if_fail": "yes", + "databases": [ + { + "dbinfo": { + "name": "mix2", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 3, + "insert_rows": 10000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "insert_interval": 0, + "timestamp_step": 10, + "start_timestamp":1500000000000, + "disorder_ratio": 10, + "update_ratio": 5, + "delete_ratio": 1, + "disorder_fill_interval": 50, + "update_fill_interval": 25, + "generate_row_rule": 3, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "max": 1, "min": 0 }, + { "type": "double", "name": "dc", "max": 1, "min": 0 }, + { "type": "tinyint", "name": "ti", "max": 100, "min": 0 }, + { "type": "smallint", "name": "si", "max": 100, "min": 0 }, + { "type": "int", "name": "ic", "max": 100, "min": 0 }, + { "type": "bigint", "name": "bi", "max": 100, "min": 0 }, + { "type": "utinyint", "name": "uti", "max": 100, "min": 0 }, + { "type": "usmallint", "name": "usi", "max": 100, "min": 0 }, + { "type": "uint", "name": "ui", "max": 100, "min": 0 }, + { "type": "ubigint", "name": "ubi", "max": 100, "min": 0 }, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64} + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/case-insert-mix3.json b/tests/army/tools/benchmark/basic/json/case-insert-mix3.json new file mode 100644 index 0000000000..b62ab51af0 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/case-insert-mix3.json @@ -0,0 +1,70 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 100, + "thread_count": 1, + "create_table_thread_count": 1, + "result_file": "./mix3.txt", + "confirm_parameter_prompt": "no", + "check_sql": "no", + "continue_if_fail": "yes", + "databases": [ + { + "dbinfo": { + "name": "mix3", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 1, + "insert_rows": 1000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "insert_interval": 1, + "timestamp_step": 1000, + "start_timestamp":"now", + "random_write_future": "yes", + "generate_row_rule": 1, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "max": 1, "min": 0 }, + { "type": "double", "name": "dc", "max": 1, "min": 0 }, + { "type": "tinyint", "name": "ti", "max": 100, "min": 0 }, + { "type": "smallint", "name": "si", "max": 100, "min": 0 }, + { "type": "int", "name": "ic", "max": 100, "min": 0 }, + { "type": "bigint", "name": "bi", "max": 100, "min": 0 }, + { "type": "utinyint", "name": "uti", "max": 100, "min": 0 }, + { "type": "usmallint", "name": "usi", "max": 100, "min": 0 }, + { "type": "uint", "name": "ui", "max": 100, "min": 0 }, + { "type": "ubigint", "name": "ubi", "max": 100, "min": 0 }, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64} + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/case-insert-mix4.json b/tests/army/tools/benchmark/basic/json/case-insert-mix4.json new file mode 100644 index 0000000000..6ce6a36abf --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/case-insert-mix4.json @@ -0,0 +1,74 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 100, + "confirm_parameter_prompt": "no", + "thread_count": 1, + "create_table_thread_count": 1, + "result_file": "./res_mix4.txt", + "databases": [ + { + "dbinfo": { + "name": "mix4", + "drop": "yes", + "stt_trigger": 6, + "flush_each_batch":"yes", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 2, + "insert_rows": 2000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "insert_interval": 0, + "timestamp_step": 10, + "start_timestamp":1600000000000, + "generate_row_rule":3, + "keep_trying": 2, + "trying_interval":10, + "check_correct_interval": 1, + "columns": [ + { "type": "timestamp", "name": "tc"}, + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "max": 1, "min": 0 }, + { "type": "double", "name": "dc", "max": 1, "min": 0 }, + { "type": "tinyint", "name": "ti", "max": 100, "min": 0 }, + { "type": "smallint", "name": "si", "max": 100, "min": 0 }, + { "type": "int", "name": "ic", "max": 100, "min": 0 }, + { "type": "bigint", "name": "bi", "max": 100, "min": 0 }, + { "type": "utinyint", "name": "uti", "max": 100, "min": 0 }, + { "type": "usmallint", "name": "usi", "max": 100, "min": 0 }, + { "type": "uint", "name": "ui", "max": 100, "min": 0 }, + { "type": "ubigint", "name": "ubi", "max": 100, "min": 0 }, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64} + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/custom_col_tag.json b/tests/army/tools/benchmark/basic/json/custom_col_tag.json new file mode 100644 index 0000000000..fc910b6e09 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/custom_col_tag.json @@ -0,0 +1,77 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": -10, + "childtable_offset": 10, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 0, + "columns": [{ + "type": "INT", + "name": "first_col" + }, { + "type": "UINT", + "name": "second_col", + "count": 5 + },{ + "type": "double", + "name": "third_col" + },{ + "type": "float", + "name": "forth_col", + "count": 3 + }], + "tags": [{ + "type": "INT", + "name": "single" + }, { + "type": "UINT", + "name": "multiple", + "count": 5 + },{ + "type": "double", + "name": "thensingle" + },{ + "type": "float", + "name": "thenmultiple", + "count": 3 + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/default.json b/tests/army/tools/benchmark/basic/json/default.json new file mode 100644 index 0000000000..da22ef75e2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/default.json @@ -0,0 +1,29 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db" + }, + "super_tables": [{ + "name": "stb", + "childtable_prefix": "stb_", + "childtable_count": 10, + "insert_rows": 10, + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/exportCsv.json b/tests/army/tools/benchmark/basic/json/exportCsv.json new file mode 100644 index 0000000000..05a7341eb6 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/exportCsv.json @@ -0,0 +1,78 @@ +{ + "filetype": "csvfile", + "csvPath": "./csv/", + "num_of_records_per_req": 10000, + "databases": [ + { + "dbinfo": { + "name": "csvdb" + }, + "super_tables": [ + { + "name": "batchTable", + "childtable_count": 5, + "insert_rows": 100, + "interlace_rows": 0, + "childtable_prefix": "d", + "timestamp_step": 10, + "start_timestamp":1600000000000, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "min": 1}, + { "type": "double", "name": "dc", "min":10, "max":10}, + { "type": "tinyint", "name": "ti"}, + { "type": "smallint", "name": "si"}, + { "type": "int", "name": "ic", "fillNull":"false"}, + { "type": "bigint", "name": "bi"}, + { "type": "utinyint", "name": "uti"}, + { "type": "usmallint", "name": "usi", "min":100, "max":120}, + { "type": "uint", "name": "ui"}, + { "type": "ubigint", "name": "ubi"}, + { "type": "binary", "name": "bin", "len": 16}, + { "type": "nchar", "name": "nch", "len": 16} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + }, + { + "name": "interlaceTable", + "childtable_count": 5, + "insert_rows": 100, + "interlace_rows": 10, + "childtable_prefix": "d", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "columns": [ + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "min":16}, + { "type": "double", "name": "dc", "min":16}, + { "type": "tinyint", "name": "ti"}, + { "type": "smallint", "name": "si"}, + { "type": "int", "name": "ic", "fillNull":"false"}, + { "type": "bigint", "name": "bi"}, + { "type": "utinyint", "name": "uti"}, + { "type": "usmallint", "name": "usi"}, + { "type": "uint", "name": "ui"}, + { "type": "ubigint", "name": "ubi"}, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/from-to.json b/tests/army/tools/benchmark/basic/json/from-to.json new file mode 100644 index 0000000000..d78f647ade --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/from-to.json @@ -0,0 +1,33 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "childtable_prefix": "d", + "child_table_exists": "yes", + "childtable_count": 10, + "insert_rows": 10, + "childtable_from": 5, + "childtable_to": 10, + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-disorder-stmt.json b/tests/army/tools/benchmark/basic/json/insert-disorder-stmt.json new file mode 100644 index 0000000000..091a51b9da --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-disorder-stmt.json @@ -0,0 +1,75 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 100, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 100, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-disorder.json b/tests/army/tools/benchmark/basic/json/insert-disorder.json new file mode 100644 index 0000000000..0967a4e008 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-disorder.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 1, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":1, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 100, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-N00-stmt.json b/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-N00-stmt.json new file mode 100644 index 0000000000..5c6f334344 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-N00-stmt.json @@ -0,0 +1,168 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NN123_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb2", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NNN_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb3", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NNY_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb4", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "NY123_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb5", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "NYN_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb6", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "NYY_", + "batch_create_tbl_num": 100, + "data_source": "stmt", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-Y00-stmt.json b/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-Y00-stmt.json new file mode 100644 index 0000000000..4185c80ab4 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-drop-exist-auto-Y00-stmt.json @@ -0,0 +1,168 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YN123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb2", + "child_table_exists":"no", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YNN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb3", + "child_table_exists":"no", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YNY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb4", + "child_table_exists":"yes", + "auto_create_table": "123", + "childtable_count": 20, + "childtable_prefix": "YY123_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb5", + "child_table_exists":"yes", + "auto_create_table": "no", + "childtable_count": 20, + "childtable_prefix": "YYN_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + },{ + "name": "stb6", + "child_table_exists":"yes", + "auto_create_table": "yes", + "childtable_count": 20, + "childtable_prefix": "YYY_", + "batch_create_tbl_num": 100, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 40, + "childtable_offset":0, + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "TINYINT"}] + } + ] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-from-to-continue-no.json b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-no.json new file mode 100644 index 0000000000..358a723551 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-no.json @@ -0,0 +1,84 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "thread_count": 4, + "create_table_thread_count": 7, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "test", + "drop": "no", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "yes", + "childtable_count": 6, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1, + "childtable_from": 2, + "childtable_to": 5, + "continue_if_fail": "no", + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2022-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "FLOAT", + "name": "current", + "count": 1, + "max": 12, + "min": 8 + }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + { + "type": "TINYINT", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "BINARY", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-from-to-continue-smart.json b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-smart.json new file mode 100644 index 0000000000..10e30ce76d --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-smart.json @@ -0,0 +1,84 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "thread_count": 4, + "create_table_thread_count": 7, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "test", + "drop": "no", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "yes", + "childtable_count": 4, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1, + "childtable_from": 0, + "childtable_to": 1, + "continue_if_fail": "smart", + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "FLOAT", + "name": "current", + "count": 1, + "max": 12, + "min": 8 + }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + { + "type": "TINYINT", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "BINARY", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-from-to-continue-yes.json b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-yes.json new file mode 100644 index 0000000000..05e7474baf --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-from-to-continue-yes.json @@ -0,0 +1,84 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "thread_count": 4, + "create_table_thread_count": 7, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "test", + "drop": "no", + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "yes", + "childtable_count": 6, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 1, + "childtable_from": 2, + "childtable_to": 5, + "continue_if_fail": "yes", + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2022-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "FLOAT", + "name": "current", + "count": 1, + "max": 12, + "min": 8 + }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + { + "type": "TINYINT", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "BINARY", + "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-interlace-row-stmt.json b/tests/army/tools/benchmark/basic/json/insert-interlace-row-stmt.json new file mode 100644 index 0000000000..0494c9bcbe --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-interlace-row-stmt.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 151, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-interlace-row.json b/tests/army/tools/benchmark/basic/json/insert-interlace-row.json new file mode 100644 index 0000000000..a40c17d1f9 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-interlace-row.json @@ -0,0 +1,61 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 150, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 151, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-json-csv.json b/tests/army/tools/benchmark/basic/json/insert-json-csv.json new file mode 100644 index 0000000000..c3c4bd9cb2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-json-csv.json @@ -0,0 +1,48 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 1, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/insert-json-csv.csv", + "columns": [{"type": "INT","count":2}, {"type": "BINARY", "len": 16, "count":1}], + "tags": [{"type": "INT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json b/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json new file mode 100644 index 0000000000..b4bf21b786 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json @@ -0,0 +1,76 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 1, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbtest123", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 80, + "disorder_range": 10, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/sample_ts.csv", + "use_sample_ts": "yes", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":2, + "childtable_prefix": "stb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "./taosbenchmark/csv/sample_ts_stmt_tags.csv", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-sample-ts.json b/tests/army/tools/benchmark/basic/json/insert-sample-ts.json new file mode 100644 index 0000000000..a94131baaa --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-sample-ts.json @@ -0,0 +1,76 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbtest123", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 80, + "disorder_range": 10, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/sample_ts.csv", + "use_sample_ts": "yes", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":2, + "childtable_prefix": "stb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/sample.csv", + "tags_file": "./taosbenchmark/csv/tags.csv", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-sample.json b/tests/army/tools/benchmark/basic/json/insert-sample.json new file mode 100644 index 0000000000..b2eb96edb6 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-sample.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "dbtest123", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset": 0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/sample.csv", + "tags_file": "", + "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": -1, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/sample.csv", + "tags_file": "./taosbenchmark/csv/tags.csv", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-timestep-stmt.json b/tests/army/tools/benchmark/basic/json/insert-timestep-stmt.json new file mode 100644 index 0000000000..4bbf3e20ff --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-timestep-stmt.json @@ -0,0 +1,75 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/insert-timestep.json b/tests/army/tools/benchmark/basic/json/insert-timestep.json new file mode 100644 index 0000000000..059643a851 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/insert-timestep.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file":"./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 10, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ms", + "keep": 36500, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count":20, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 20, + "childtable_limit": 0, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "interlace_rows": 0, + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/queryInsertdata.json b/tests/army/tools/benchmark/basic/json/queryInsertdata.json new file mode 100644 index 0000000000..3f5f63ce78 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryInsertdata.json @@ -0,0 +1,73 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 10, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 200, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0 , + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 1, "count":3}, {"type": "BINARY", "len": 2, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/queryInsertrestdata.json b/tests/army/tools/benchmark/basic/json/queryInsertrestdata.json new file mode 100644 index 0000000000..6714497766 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryInsertrestdata.json @@ -0,0 +1,73 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "thread_count_create_tbl": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 0, + "num_of_records_per_req": 3000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb00_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 1, "count":1}, {"type": "BINARY", "len": 3, "count":1}, {"type": "INT"}, {"type": "DOUBLE", "count":1}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 2, + "childtable_prefix": "stb01_", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 5, + "childtable_limit": 0, + "childtable_offset": 0, + "interlace_rows": 0 , + "insert_interval": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-11-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":6}, {"type": "BINARY", "len": 1, "count":3}, {"type": "BINARY", "len": 2, "count":6}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/queryQps.json b/tests/army/tools/benchmark/basic/json/queryQps.json new file mode 100644 index 0000000000..02661fe9d2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryQps.json @@ -0,0 +1,35 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 1, + "specified_table_query": { + "query_interval": 10, + "threads": 4, + "sqls": [ + { + "sql": "select last_row(*) from db.stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_9 ", + "result": "./query_res1.txt" + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval":20, + "threads": 4, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } diff --git a/tests/army/tools/benchmark/basic/json/queryRestful.json b/tests/army/tools/benchmark/basic/json/queryRestful.json new file mode 100644 index 0000000000..5de560fd21 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryRestful.json @@ -0,0 +1,38 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 2, + "query_mode": "rest", + "specified_table_query": { + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(*) from db.stb0 ", + "result": "./query_res0.txt" + }, + { + "sql": "select count(*) from db.stb00_1", + "result": "./query_res1.txt" + } + ] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } + } + diff --git a/tests/army/tools/benchmark/basic/json/querySpeciMutisql100.json b/tests/army/tools/benchmark/basic/json/querySpeciMutisql100.json new file mode 100644 index 0000000000..5b523ad3dd --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/querySpeciMutisql100.json @@ -0,0 +1,429 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 2, + "specified_table_query": { + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(*) from db.stb00_0", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_1", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_2", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_3", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_4", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_5", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_6", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_7", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_8", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_9", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_10 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_11 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_12 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_13 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_14 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_15 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_16 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_17 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_18 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_19 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_20 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_21 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_22 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_23 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_24 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_25 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_26 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_27 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_28 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_29 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_30 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_31 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_32 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_33 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_34 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_35 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_36 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_37 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_38 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_39 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_40 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_41 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_42 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_43 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_44 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_45 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_46 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_47 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_48 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_49 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_50 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_51 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_52 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_53 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_54 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_55 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_56 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_57 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_58 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_59 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_60", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_61", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_62", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_63", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_64", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_65", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_66", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_67", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_68", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_69", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_70 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_71 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_72 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_73 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_74 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_75 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_76 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_77 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_78 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_79 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_80 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_81 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_82 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_83 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_84 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_85 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_86 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_87 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_88 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_89 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_90 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_91 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_92 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_93 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_94 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_95 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_96 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_97 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_98 ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from db.stb00_99 ", + "result": "./query_res0.txt" + + }] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } +} + \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/querySuperMutisql100.json b/tests/army/tools/benchmark/basic/json/querySuperMutisql100.json new file mode 100644 index 0000000000..f6947a6d74 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/querySuperMutisql100.json @@ -0,0 +1,419 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 3, + "super_table_query": { + "stblname": "stb0", + "query_interval": 10, + "threads": 9, + "sqls": [ + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select last_row(*) from xxxx ", + "result": "./query_res0.txt" + }, + { + "sql": "select * from xxxx ", + "result": "./query_res0.txt" + + }] + } + } + diff --git a/tests/army/tools/benchmark/basic/json/queryTaosc-mixed-query.json b/tests/army/tools/benchmark/basic/json/queryTaosc-mixed-query.json new file mode 100644 index 0000000000..9b2f1b4675 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryTaosc-mixed-query.json @@ -0,0 +1,38 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 2, + "query_mode": "taosc", + "specified_table_query": { + "mixed_query": "yes", + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(*) from db.stb0 ", + "result": "./query_res0.txt" + }, + { + "sql": "select count(*) from db.stb00_1", + "result": "./query_res1.txt" + } + ] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json/queryTaosc.json b/tests/army/tools/benchmark/basic/json/queryTaosc.json new file mode 100644 index 0000000000..d1e64e645f --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/queryTaosc.json @@ -0,0 +1,37 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 2, + "query_mode": "taosc", + "specified_table_query": { + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(*) from db.stb0 ", + "result": "./query_res0.txt" + }, + { + "sql": "select count(*) from db.stb00_1", + "result": "./query_res1.txt" + } + ] + }, + "super_table_query": { + "stblname": "stb1", + "query_interval": 1, + "threads": 3, + "sqls": [ + { + "sql": "select last_row(ts) from xxxx", + "result": "./query_res2.txt" + } + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json/rest_auto_create_table.json b/tests/army/tools/benchmark/basic/json/rest_auto_create_table.json new file mode 100644 index 0000000000..30a627d9c6 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/rest_auto_create_table.json @@ -0,0 +1,74 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 100, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ns" + }, + "super_tables": [{ + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "rest", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb3-2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb3-2_", + "escape_character": "yes", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "rest", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/rest_insert_alltypes.json b/tests/army/tools/benchmark/basic/json/rest_insert_alltypes.json new file mode 100644 index 0000000000..23d0e4fb4c --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/rest_insert_alltypes.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "insert_mode": "rest", + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "rest", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/rest_query.json b/tests/army/tools/benchmark/basic/json/rest_query.json new file mode 100644 index 0000000000..459e496f0b --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/rest_query.json @@ -0,0 +1,27 @@ +{ + "filetype":"query", + "cfgdir": "/etc/taos", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_mode": "rest", + "connection_pool_size": 10, + "response_buffer": 10000, + "specified_table_query": + { + "query_times": 1, + "sqls": + [{ + "sql": "select count(*) from db.stb", + "result": "rest_query_specified" + }] + }, + "super_table_query": { + "stblname": "stb", + "sqls": [ + { + "sql": "select count(*) from xxxx", + "result": "rest_query_super" + } + ] + } +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/reuse-exist-stb.json b/tests/army/tools/benchmark/basic/json/reuse-exist-stb.json new file mode 100644 index 0000000000..5cbaaf8a74 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/reuse-exist-stb.json @@ -0,0 +1,63 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "thread_count": 4, + "create_table_thread_count": 7, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "no", + "precision": "ms" + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 1, + "childtable_prefix": "new_", + "escape_character": "yes", + "auto_create_table": "no", + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "insert_rows": 5, + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2022-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { "type": "INT", "name": "c0", "max": 225, "min": 215 } + ], + "tags": [ + { + "type": "INT", + "name": "t0", + "max": 10, + "min": 1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_auto_create_table.json b/tests/army/tools/benchmark/basic/json/sml_auto_create_table.json new file mode 100644 index 0000000000..c0d7d3ae2e --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_auto_create_table.json @@ -0,0 +1,73 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 100, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb4-2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb4-2_", + "escape_character": "yes", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_insert_alltypes.json b/tests/army/tools/benchmark/basic/json/sml_insert_alltypes.json new file mode 100644 index 0000000000..507665f7a5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_insert_alltypes.json @@ -0,0 +1,48 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 32, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 32, "count":1}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 32, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 32, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_interlace.json b/tests/army/tools/benchmark/basic/json/sml_interlace.json new file mode 100644 index 0000000000..9afe29c45c --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_interlace.json @@ -0,0 +1,73 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 30, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 60, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_json_alltypes-interlace.json b/tests/army/tools/benchmark/basic/json/sml_json_alltypes-interlace.json new file mode 100644 index 0000000000..b5b8819565 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_json_alltypes-interlace.json @@ -0,0 +1,248 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 2, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BOOL"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TINYINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb3_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb4_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb5_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb6_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb7_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb8_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb9_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "NCHAR", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_json_alltypes.json b/tests/army/tools/benchmark/basic/json/sml_json_alltypes.json new file mode 100644 index 0000000000..26a08b3fee --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_json_alltypes.json @@ -0,0 +1,248 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BOOL"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TINYINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb3_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb4_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb5_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb6_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb7_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb8_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb9_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "NCHAR", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_json_insert_alltypes-same-min-max.json b/tests/army/tools/benchmark/basic/json/sml_json_insert_alltypes-same-min-max.json new file mode 100644 index 0000000000..13c59e03c5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_json_insert_alltypes-same-min-max.json @@ -0,0 +1,44 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "t", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "json", + "insert_rows": 10, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-02-01 00:00:00.000", + "tags_file": "", + "columns": [{"type": "INT","max": 1, "min": 1}], + "tags": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_rest_json.json b/tests/army/tools/benchmark/basic/json/sml_rest_json.json new file mode 100644 index 0000000000..7b05b73df3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_rest_json.json @@ -0,0 +1,93 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [ + { + "dbinfo": { + "name": "db3", + "drop": "yes" + }, + "super_tables": [ + { + "name": "stb1", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + } + ], + "tags": [ + { + "type": "INT" + } + ] + },{ + "name": "stb2", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "json", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 3, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + } + ], + "tags": [ + { + "type": "INT" + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_rest_line.json b/tests/army/tools/benchmark/basic/json/sml_rest_line.json new file mode 100644 index 0000000000..8f5537e9a9 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_rest_line.json @@ -0,0 +1,253 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [ + { + "dbinfo": { + "name": "db2", + "drop": "yes" + }, + "super_tables": [ + { + "name": "stb1", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ], + "tags": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ] + },{ + "name": "stb2", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 6, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ], + "tags": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_rest_telnet.json b/tests/army/tools/benchmark/basic/json/sml_rest_telnet.json new file mode 100644 index 0000000000..3767073093 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_rest_telnet.json @@ -0,0 +1,173 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [ + { + "name": "stb1", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + } + ], + "tags": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ] + },{ + "name": "stb2", + "child_table_exists": "no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT" + } + ], + "tags": [ + { + "type": "INT" + }, + { + "type": "BIGINT" + }, + { + "type": "FLOAT" + }, + { + "type": "DOUBLE" + }, + { + "type": "SMALLINT" + }, + { + "type": "TINYINT" + }, + { + "type": "BOOL" + }, + { + "type": "NCHAR", + "len": 17, + "count": 1 + }, + { + "type": "UINT" + }, + { + "type": "UBIGINT" + }, + { + "type": "UTINYINT" + }, + { + "type": "USMALLINT" + }, + { + "type": "BINARY", + "len": 19, + "count": 1 + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_taosjson_alltypes.json b/tests/army/tools/benchmark/basic/json/sml_taosjson_alltypes.json new file mode 100644 index 0000000000..f2aae84109 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_taosjson_alltypes.json @@ -0,0 +1,248 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BOOL"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TINYINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb3_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb4_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb5_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb6_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb7_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb8_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb9_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "NCHAR", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_taosjson_insert_alltypes-same-min-max.json b/tests/army/tools/benchmark/basic/json/sml_taosjson_insert_alltypes-same-min-max.json new file mode 100644 index 0000000000..a1c97ec8e9 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_taosjson_insert_alltypes-same-min-max.json @@ -0,0 +1,44 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "t", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "taosjson", + "insert_rows": 10, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-02-01 00:00:00.000", + "tags_file": "", + "columns": [{"type": "NCHAR", "len": 8}], + "tags": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "NCHAR","len": 17, "count":1}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_telnet_alltypes.json b/tests/army/tools/benchmark/basic/json/sml_telnet_alltypes.json new file mode 100644 index 0000000000..1cdb5c4d47 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_telnet_alltypes.json @@ -0,0 +1,348 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BOOL"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TINYINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb3", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb3_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "UTINYINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb4", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb4_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "SMALLINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb5", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb5_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "USMALLINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb6", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb6_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb7", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb7_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "UINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb8", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb8_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BIGINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb9", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb9_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "UBIGINT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb10", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb10_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "FLOAT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb11", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb11_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "DOUBLE"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb12", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb12_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "BINARY", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb13", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb13_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "NCHAR", "len": 8}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_telnet_insert_alltypes-same-min-max.json b/tests/army/tools/benchmark/basic/json/sml_telnet_insert_alltypes-same-min-max.json new file mode 100644 index 0000000000..ceff470383 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_telnet_insert_alltypes-same-min-max.json @@ -0,0 +1,44 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "t", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml", + "line_protocol": "telnet", + "insert_rows": 10, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-02-01 00:00:00.000", + "tags_file": "", + "columns": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}], + "tags": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/sml_telnet_tcp.json b/tests/army/tools/benchmark/basic/json/sml_telnet_tcp.json new file mode 100644 index 0000000000..a4b31d8e47 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/sml_telnet_tcp.json @@ -0,0 +1,73 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "telnet_tcp_port": 6046, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "opentsdb_telnet", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "telnet", + "tcp_transfer": "yes", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "sml-rest", + "line_protocol": "telnet", + "tcp_transfer": "yes", + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_range": 1000, + "timestamp_step": 1000, + "start_timestamp": "2024-08-01 10:00:00", + "sample_file": "", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/specified_subscribe.json b/tests/army/tools/benchmark/basic/json/specified_subscribe.json new file mode 100644 index 0000000000..4f730a9cbf --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/specified_subscribe.json @@ -0,0 +1,24 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "specified_table_query": { + "threads": 1, + "mode": "async", + "interval": 1000, + "restart": "no", + "keepProgress": "yes", + "resubAfterConsume": 10, + "endAfterConsume": 1, + "sqls": [ + { + "sql": "select * from stb;" + } + ] + } +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_no.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_no.json new file mode 100644 index 0000000000..959e64a469 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_no.json @@ -0,0 +1,50 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 30, + "prepared_rand": 100, + "thread_count": 2, + "thread_bind_vgroup": "yes", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 2 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 20000, + "interlace_rows": 0, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "no", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_yes.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_yes.json new file mode 100644 index 0000000000..46e136e719 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_batch_autoctb_yes.json @@ -0,0 +1,50 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 30, + "prepared_rand": 100, + "thread_count": 2, + "thread_bind_vgroup": "yes", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 2 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 20000, + "interlace_rows": 0, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "yes", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json new file mode 100644 index 0000000000..aee3296249 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json @@ -0,0 +1,53 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 3, + "prepared_rand": 200, + "thread_count": 1, + "thread_bind_vgroup": "yes", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 1 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 200, + "interlace_rows": 0, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "no", + "data_source": "sample", + "sample_file": "./taosbenchmark/csv/d0.csv", + "use_sample_ts": "yes", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json new file mode 100644 index 0000000000..150f6a8c57 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json @@ -0,0 +1,53 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 30, + "prepared_rand": 300, + "thread_count": 1, + "thread_bind_vgroup": "yes", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 1 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 200, + "interlace_rows": 5, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "yes", + "data_source": "sample", + "sample_file": "./taosbenchmark/csv/d0.csv", + "use_sample_ts": "yes", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_no.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_no.json new file mode 100644 index 0000000000..b08e281da4 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_no.json @@ -0,0 +1,50 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 3, + "prepared_rand": 10, + "thread_count": 1, + "thread_bind_vgroup": "no", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 2 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 20, + "interlace_rows": 1, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "no", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_yes.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_yes.json new file mode 100644 index 0000000000..83a27ba04d --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_yes.json @@ -0,0 +1,50 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 300, + "prepared_rand": 1000, + "thread_count": 2, + "thread_bind_vgroup": "yes", + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "dbstmt2", + "drop": "yes", + "vgroups": 2 + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 20000, + "interlace_rows": 5, + "childtable_prefix": "d", + "insert_mode": "stmt2", + "timestamp_step": 1000, + "start_timestamp":1700000000000, + "auto_create_table": "yes", + "columns": [ + {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, + { "type": "INT", "name": "voltage", "max": 225, "min": 215 }, + { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 } + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_auto_create_table.json b/tests/army/tools/benchmark/basic/json/stmt_auto_create_table.json new file mode 100644 index 0000000000..adc94c1437 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_auto_create_table.json @@ -0,0 +1,72 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 100, + "chinese": "no", + "escape_character": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb2-2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb2-2_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes-same-min-max.json b/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes-same-min-max.json new file mode 100644 index 0000000000..72aaaff745 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes-same-min-max.json @@ -0,0 +1,43 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 5, + "childtable_prefix": "t", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "insert_rows": 5, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-02-01 00:00:00.000", + "tags_file": "", + "columns": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 0, "min": 0}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes.json b/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes.json new file mode 100644 index 0000000000..dc1ca5c9d4 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_insert_alltypes.json @@ -0,0 +1,57 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "stmt", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 29, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 23, "count":1, + "values": ["b1","b2"] + }], + "tags": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 17, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 19, "count":1, + "values": ["b1","b2"] + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_limit_offset.json b/tests/army/tools/benchmark/basic/json/stmt_limit_offset.json new file mode 100644 index 0000000000..dbddbc60e8 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_limit_offset.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": 2, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 3, + "columns": [{"type": "TIMESTAMP"},{"type": "INT", "len": 0}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json b/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json new file mode 100644 index 0000000000..67253fefa4 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "stmt", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 10, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./taosbenchmark/csv/sample_no_ts.csv", + "use_sample_ts": "no", + "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json new file mode 100644 index 0000000000..67fce72843 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb", + "childtable_sample_file": "./taosbenchmark/csv/sample_use_ts-XXXX.csv", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "stmt", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "use_sample_ts": "yes", + "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json new file mode 100644 index 0000000000..3a6185ef11 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "stmt", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "use_sample_ts": "yes", + "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/stream-test.json b/tests/army/tools/benchmark/basic/json/stream-test.json new file mode 100644 index 0000000000..4b879d4bee --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stream-test.json @@ -0,0 +1,114 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 4, + "thread_count": 4, + "create_table_thread_count": 4, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 100, + "prepared_rand": 10000, + "chinese": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes", + "precision": "ms" + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 10, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 5, + "data_source": "rand", + "insert_mode": "taosc", + "non_stop_mode": "no", + "line_protocol": "line", + "insert_rows": 10, + "interlace_rows": 0, + "insert_interval": 0, + "partial_col_num": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10000, + "start_timestamp": "2022-10-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "FLOAT", + "name": "current", + "count": 1, + "max": 12, + "min": 8 + }, + { + "type": "INT", + "name": "voltage", + "max": 225, + "min": 215 + }, + { + "type": "FLOAT", + "name": "phase", + "max": 1, + "min": 0 + } + ], + "tags": [ + { + "type": "TINYINT", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "BINARY", + "len": 16, + "values": [ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + } + ] + } + ] + }, + { + "dbinfo": { + "name": "stream_db1", + "drop": "yes" + } + } + ], + "streams": [ + { + "stream_name": "test_stream1", + "stream_stb": "stream_db1.output_stb", + "source_sql": "select _wstart,max(current) as mm from db.stb interval(10s)", + "drop": "yes" + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_insert_partition.json b/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_insert_partition.json new file mode 100644 index 0000000000..6e59bbae4c --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_insert_partition.json @@ -0,0 +1,104 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "rest_port": 6041, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 8, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "max_sql_len": 1024000, + "databases": [ + { + "dbinfo": { + "name": "stream_test", + "drop": "no", + "replica": 1, + "precision": "ms", + "keep": 3650 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "yes", + "childtable_count": 100, + "childtable_prefix": "ctb0_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "rollup": null, + "interlace_rows": 0, + "line_protocol": null, + "tcp_transfer": "no", + "insert_rows": 1000, + "partial_col_num": 0, + "childtable_limit": 0, + "childtable_offset": 0, + "rows_per_tbl": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "keep_trying": 0, + "timestamp_step": 1100, + "trying_interval": 0, + "start_timestamp": "2020-01-01 00:00:00", + "sample_format": "csv", + "sample_file": "", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "FLOAT", + "count": 2 + }, + { + "type": "TINYINT", + "count": 1 + } + + ], + "tags": [ + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "BINARY", + "count": 1, + "len": 16 + } + ] + } + ] + } + ], + "prepare_rand": 10000, + "chinese": "no", + "streams": [ + { + "stream_name": "stream_stability", + "stream_stb": "stream_test.output_streamtb", + "trigger_mode": "at_once", + "watermark": "30s", + "subtable": "(concat(tbname, \"_suffix\"))", + "fill_history": "1", + "ignore_expired": "0", + "ignore_update": "1", + "stream_stb_field": "(ts,c1,c2,c3)", + "stream_tag_field": "(t1)", + "source_sql": "select _wstart as wstart, min(c1),max(c2), count(c3) from stream_test.stb partition by cast(t1 as int) t1,tbname interval(1s)", + "drop": "yes" + } + ] +} diff --git a/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_prepare.json b/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_prepare.json new file mode 100644 index 0000000000..7d12961451 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/stream_exist_stb_tag_prepare.json @@ -0,0 +1,143 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "rest_port": 6041, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 8, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "max_sql_len": 1024000, + "databases": [ + { + "dbinfo": { + "name": "stream_test", + "drop": "yes", + "replica": 1, + "precision": "ms", + "keep": 3650 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 100, + "childtable_prefix": "ctb0_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "rollup": null, + "interlace_rows": 0, + "line_protocol": null, + "tcp_transfer": "no", + "insert_rows": 1000, + "partial_col_num": 0, + "childtable_limit": 0, + "childtable_offset": 0, + "rows_per_tbl": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "keep_trying": 0, + "timestamp_step": 1100, + "trying_interval": 0, + "start_timestamp": "2020-01-01 00:00:00", + "sample_format": "csv", + "sample_file": "", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "FLOAT", + "count": 2 + }, + { + "type": "TIMESTAMP", + "count": 1 + } + ], + "tags": [ + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "BINARY", + "count": 1, + "len": 16 + } + ] + }, + { + "name": "output_streamtb", + "child_table_exists": "no", + "childtable_count": 1, + "childtable_prefix": "ctb1_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "rollup": null, + "interlace_rows": 1, + "line_protocol": null, + "tcp_transfer": "no", + "insert_rows": 0, + "partial_col_num": 0, + "childtable_limit": 0, + "childtable_offset": 0, + "rows_per_tbl": 0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "keep_trying": 0, + "timestamp_step": 1100, + "trying_interval": 0, + "start_timestamp": "2020-01-01 00:00:00", + "sample_format": "csv", + "sample_file": "", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "FLOAT", + "count": 2 + }, + { + "type": "TINYINT", + "count": 1 + } + + ], + "tags": [ + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "BINARY", + "count": 1, + "len": 16 + } + ] + } + ] + } + ], + "prepare_rand": 10000, + "chinese": "no" +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/super_subscribe.json b/tests/army/tools/benchmark/basic/json/super_subscribe.json new file mode 100644 index 0000000000..6284caf8b2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/super_subscribe.json @@ -0,0 +1,24 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "super_table_query": { + "stblname": "stb", + "threads": 1, + "mode": "sync", + "interval": 1000, + "restart": "yes", + "keepProgress": "yes", + "endAfterConsume": 1, + "sqls": [ + { + "sql": "select * from xxxx;" + } + ] + } +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/taosc_auto_create_table.json b/tests/army/tools/benchmark/basic/json/taosc_auto_create_table.json new file mode 100644 index 0000000000..a1f692211d --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_auto_create_table.json @@ -0,0 +1,76 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 100, + "chinese": "no", + "escape_character": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 5, + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + },{ + "name": "stb1-2", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb1-2_", + "auto_create_table": "yes", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 180, + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 5, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 5, + "columns": [{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-partial-col.json b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-partial-col.json new file mode 100644 index 0000000000..feb972fc96 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-partial-col.json @@ -0,0 +1,57 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "insert_rows": 20, + "partial_col_num": 2, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 29, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 23, "count":1, + "values": ["b1","b2"] + }], + "tags": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 17, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 19, "count":1, + "values": ["b1","b2"] + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-same-min-max.json b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-same-min-max.json new file mode 100644 index 0000000000..24ba0b4450 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes-same-min-max.json @@ -0,0 +1,43 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "t", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-02-01 00:00:00.000", + "tags_file": "", + "columns": [{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 1, "min": 1}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT","max": 1, "min": 1}, {"type": "BIGINT","max": 3000000000, "min": 3000000000}, {"type": "FLOAT","max": 1.0, "min": 1.0}, {"type": "DOUBLE","max": 1.0, "min": 1.0}, {"type": "SMALLINT","max": 1, "min": 1}, {"type": "TINYINT","max": 1, "min": 1}, {"type": "BOOL","max": 0, "min": 0}, {"type": "UINT","max": 4000000000, "min": 4000000000}, {"type": "UBIGINT","max": 5000000000, "min": 5000000000}, {"type": "UTINYINT","max": 30, "min": 30}, {"type": "USMALLINT","max": 60000, "min": 60000}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes.json b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes.json new file mode 100644 index 0000000000..e53ecb417f --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_alltypes.json @@ -0,0 +1,56 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 29, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 23, "count":1, + "values": ["b1","b2"] + }], + "tags": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}, {"type": "BIGINT","max": 10, "min": 0}, {"type": "FLOAT","max": 10, "min": 0}, {"type": "DOUBLE","max": 10, "min": 0}, {"type": "SMALLINT","max": 10, "min": 0}, {"type": "TINYINT","max": 10, "min": 0}, {"type": "BOOL","max": 10, "min": 0}, {"type": "NCHAR","len": 17, "count":1, + "values": ["d1", "d2"] + }, {"type": "UINT","max": 10, "min": 0}, {"type": "UBIGINT","max": 10, "min": 0}, {"type": "UTINYINT","max": 10, "min": 0}, {"type": "USMALLINT","max": 10, "min": 0}, {"type": "BINARY", "len": 19, "count":1, + "values": ["b1","b2"] + }] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_retry-global.json b/tests/army/tools/benchmark/basic/json/taosc_insert_retry-global.json new file mode 100644 index 0000000000..2782320fa6 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_retry-global.json @@ -0,0 +1,45 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "keep_trying": 10, + "trying_interval": 1000, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 1, + "databases": [{ + "dbinfo": { + "name": "test", + "drop": "yes" + }, + "super_tables": [{ + "name": "meters", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "insert_rows": 10, + "insert_interval": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-10-01 00:00:00.000", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}], + "tags": [{"type": "INT","max": 10, "min": 0}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_retry-stb.json b/tests/army/tools/benchmark/basic/json/taosc_insert_retry-stb.json new file mode 100644 index 0000000000..51461acd2b --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_retry-stb.json @@ -0,0 +1,45 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 1, + "databases": [{ + "dbinfo": { + "name": "test", + "drop": "yes" + }, + "super_tables": [{ + "name": "meters", + "child_table_exists":"no", + "childtable_count": 1, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "keep_trying": 10, + "trying_interval": 1000, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "insert_rows": 10, + "insert_interval": 1000, + "timestamp_step": 1, + "start_timestamp": "2022-10-01 00:00:00.000", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}], + "tags": [{"type": "INT","max": 10, "min": 0}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_insert_table-creating-interval.json b/tests/army/tools/benchmark/basic/json/taosc_insert_table-creating-interval.json new file mode 100644 index 0000000000..c8e037b137 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_insert_table-creating-interval.json @@ -0,0 +1,47 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 8, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 1, + "databases": [{ + "dbinfo": { + "name": "test", + "drop": "yes" + }, + "super_tables": [{ + "name": "meters", + "child_table_exists":"no", + "childtable_count": 20, + "childtable_prefix": "d", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_numbers": "1,2,3,4", + "batch_create_tbl_intervals": "1000,2000,3000,4000", + "keep_trying": 10, + "trying_interval": 1000, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "ttl": 360, + "insert_rows": 0, + "insert_interval": 0, + "timestamp_step": 1, + "start_timestamp": "2022-10-01 00:00:00.000", + "tags_file": "", + "partial_col_num": 999, + "columns": [{"type": "TIMESTAMP","max": 10, "min": 0},{"type": "INT","max": 10, "min": 0}], + "tags": [{"type": "INT","max": 10, "min": 0}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_json_tag.json b/tests/army/tools/benchmark/basic/json/taosc_json_tag.json new file mode 100644 index 0000000000..9322391b5e --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_json_tag.json @@ -0,0 +1,48 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "INT"}], + "tags": [{"type": "JSON", "len": 8, "count": 5}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_limit_offset.json b/tests/army/tools/benchmark/basic/json/taosc_limit_offset.json new file mode 100644 index 0000000000..dbddbc60e8 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_limit_offset.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "no" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"yes", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": 2, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "partial_col_num": 3, + "columns": [{"type": "TIMESTAMP"},{"type": "INT", "len": 0}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 29, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 23, "count":1}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR","len": 17, "count":1}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY", "len": 19, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_only_create_table.json b/tests/army/tools/benchmark/basic/json/taosc_only_create_table.json new file mode 100644 index 0000000000..f29cda3453 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_only_create_table.json @@ -0,0 +1,48 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "no", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "yes", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "rand", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 0, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "2020-10-01 00:00:00.000", + "sample_file": "./sample.csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR"}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY"}], + "tags": [{"type": "TIMESTAMP"},{"type": "INT"}, {"type": "BIGINT"}, {"type": "FLOAT"}, {"type": "DOUBLE"}, {"type": "SMALLINT"}, {"type": "TINYINT"}, {"type": "BOOL"}, {"type": "NCHAR"}, {"type": "UINT"}, {"type": "UBIGINT"}, {"type": "UTINYINT"}, {"type": "USMALLINT"}, {"type": "BINARY"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json b/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json new file mode 100644 index 0000000000..fe87790d18 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json @@ -0,0 +1,20 @@ +{ + "filetype":"query", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "continue_if_fail": "yes", + "databases": "db", + "query_times": 1, + "reset_query_cache": "yes", + "specified_table_query": + { + "query_interval": 1, + "concurrent":1, + "sql_file": "./taosbenchmark/json/query-error-sqls.txt", + "result": "taosc_query_specified-sqlfile" + } +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json b/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json new file mode 100644 index 0000000000..6fc8e01605 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json @@ -0,0 +1,19 @@ +{ + "filetype": "query", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "test", + "query_times": 2, + "query_mode": "taosc", + "kill_slow_query_threshold": 3, + "kill_slow_query_interval": 1, + "specified_table_query": { + "query_interval": 3, + "concurrent": 3, + "sql_file": "./taosbenchmark/json/query-sqls-slow-query.txt" + } +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json b/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json new file mode 100644 index 0000000000..236e87a36d --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json @@ -0,0 +1,19 @@ +{ + "filetype":"query", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 1, + "reset_query_cache": "yes", + "specified_table_query": + { + "query_interval": 1, + "concurrent":1, + "sql_file": "./taosbenchmark/json/query-sqls.txt", + "result": "taosc_query_specified-sqlfile" + } +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_query.json b/tests/army/tools/benchmark/basic/json/taosc_query.json new file mode 100644 index 0000000000..c8ff2e9275 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_query.json @@ -0,0 +1,33 @@ +{ + "filetype":"query", + "cfgdir": "/etc/taos", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "databases": "db", + "query_times": 1, + "reset_query_cache": "yes", + "specified_table_query": + { + "query_interval": 1, + "concurrent":1, + "sqls": + [{ + "sql": "select count(*) from db.stb", + "result": "taosc_query_specified" + }] + }, + "super_table_query": { + "stblname": "stb", + "query_interval": 1, + "concurrent": 1, + "sqls": [ + { + "sql": "select count(*) from xxxx", + "result": "taosc_query_super" + } + ] + } +} \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json new file mode 100644 index 0000000000..e2396a99ae --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb", + "childtable_sample_file": "./taosbenchmark/csv/sample_use_ts-XXXX.csv", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "taosc", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "use_sample_ts": "yes", + "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json new file mode 100644 index 0000000000..109e0428f8 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json @@ -0,0 +1,49 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 4, + "create_table_thread_count": 2, + "connection_pool_size": 20, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "prepared_rand": 10, + "chinese": "yes", + "insert_interval": 0, + "num_of_records_per_req": 10, + "databases": [{ + "dbinfo": { + "name": "db", + "drop": "yes" + }, + "super_tables": [{ + "name": "stb", + "child_table_exists":"no", + "childtable_count": 8, + "childtable_prefix": "stb_", + "escape_character": "no", + "auto_create_table": "no", + "batch_create_tbl_num": 10, + "data_source": "sample", + "insert_mode": "taosc", + "line_protocol": "line", + "childtable_limit": 0, + "childtable_offset": 0, + "insert_rows": 20, + "insert_interval": 0, + "interlace_rows": 0, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 1, + "start_timestamp": "now", + "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "use_sample_ts": "yes", + "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "columns": [{"type": "INT"}], + "tags": [{"type": "INT"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabase.json b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabase.json new file mode 100644 index 0000000000..afe156e18c --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabase.json @@ -0,0 +1,87 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "nsdb", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ns", + "keep": 3600, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "tb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10000000, + "start_timestamp": "2021-07-01 00:00:00.000", + "sample_format": "", + "sample_file": "", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":2}, {"type": "BINARY", "len": 32, "count":2}, + {"type": "TIMESTAMP"}, {"type": "BIGINT", "count":3},{"type": "FLOAT", "count":1},{"type": "SMALLINT", "count":1},{"type": "TINYINT", "count":1}, + {"type": "BOOL"},{"type": "NCHAR","len":16}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5},{"type": "NCHAR","len":16, "count":1}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "tb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 1000, + "timestamp_step": 10000000, + "start_timestamp": "2021-07-01 00:00:00.000", + "sample_format": "", + "sample_file": "", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":2}, {"type": "BINARY", "len": 32, "count":2}, + {"type": "TIMESTAMP"}, {"type": "BIGINT", "count":3},{"type": "FLOAT", "count":1},{"type": "SMALLINT", "count":1},{"type": "TINYINT", "count":1}, + {"type": "BOOL"},{"type": "NCHAR","len":16}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5},{"type": "NCHAR","len":16, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabaseNow.json b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabaseNow.json new file mode 100644 index 0000000000..dede88c2df --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabaseNow.json @@ -0,0 +1,61 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "nsdb2", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ns", + "keep": 3600, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "tb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "now", + "sample_format": "", + "sample_file": "", + "tags_file": "", + "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":2}, {"type": "BINARY", "len": 32, "count":2}, + {"type": "TIMESTAMP"}, {"type": "BIGINT", "count":3},{"type": "FLOAT", "count":1},{"type": "SMALLINT", "count":1},{"type": "TINYINT", "count":1}, + {"type": "BOOL"},{"type": "NCHAR","len":16}], + "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5},{"type": "NCHAR","len":16, "count":1}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json new file mode 100644 index 0000000000..685de732e9 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json @@ -0,0 +1,83 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "thread_count_create_tbl": 10, + "result_file": "./insert_res.txt", + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 100, + "num_of_records_per_req": 1000, + "max_sql_len": 1024000, + "databases": [{ + "dbinfo": { + "name": "nsdbcsv", + "drop": "yes", + "replica": 1, + "days": 10, + "cache": 50, + "blocks": 8, + "precision": "ns", + "keep": 3600, + "minRows": 100, + "maxRows": 4096, + "comp":2, + "cachelast":0, + "quorum":1, + "fsync":3000, + "update": 0 + }, + "super_tables": [{ + "name": "stb0", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "tb0_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "samples", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10000000, + "start_timestamp": "2021-07-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/nano_samples.csv", + "tags_file": "./taosbenchmark/csv/nano_sampletags.csv", + "columns": [{"type": "DOUBLE"}, {"type": "BINARY", "len": 64, "count":1}, {"type": "TIMESTAMP", "count":1}], + "tags": [{"type": "BINARY", "len": 16, "count":1},{"type": "INT"},{"type": "DOUBLE"}] + }, + { + "name": "stb1", + "child_table_exists":"no", + "childtable_count": 100, + "childtable_prefix": "tb1_", + "auto_create_table": "no", + "batch_create_tbl_num": 20, + "data_source": "samples", + "insert_mode": "taosc", + "insert_rows": 100, + "childtable_offset":0, + "multi_thread_write_one_tbl": "no", + "insert_interval":0, + "max_sql_len": 1024000, + "disorder_ratio": 10, + "disorder_range": 1000, + "timestamp_step": 10000000, + "start_timestamp": "2021-07-01 00:00:00.000", + "sample_format": "csv", + "sample_file": "./taosbenchmark/csv/nano_samples.csv", + "tags_file": "./taosbenchmark/csv/nano_sampletags.csv", + "columns": [{"type": "DOUBLE"}, {"type": "BINARY", "len": 64, "count":1}, {"type": "TIMESTAMP", "count":1}], + "tags": [{"type": "BINARY", "len": 16, "count":1},{"type": "INT"},{"type": "DOUBLE"}] + }] + }] +} diff --git a/tests/army/tools/benchmark/basic/json/tmq.json b/tests/army/tools/benchmark/basic/json/tmq.json new file mode 100644 index 0000000000..cf0eb1b297 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/tmq.json @@ -0,0 +1,28 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "databases": "db", + "confirm_parameter_prompt": "no", + "result_file": "./tmq_result1.txt", + "tmq_info": { + "concurrent": 2, + "poll_delay": 3000, + "group.id": "grpId_0", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "false", + "rows_file": "./consumed_rows1", + "expect_rows": 50, + "topic_list": [ + {"name": "tmq_topic_0", "sql": "select c0 from db.stb;"} + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json/tmq_basic.json b/tests/army/tools/benchmark/basic/json/tmq_basic.json new file mode 100644 index 0000000000..b1ecbb1d30 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/tmq_basic.json @@ -0,0 +1,28 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "result_file": "./tmq_result.txt", + "tmq_info": { + "concurrent": 2, + "poll_delay": 3000, + "group.id": "grpId_0", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "true", + "rows_file": "./consumed_rows", + "expect_rows": -1, + "topic_list": [ + {"name": "tmq_topic_0", "sql": "select * from db.stb;"}, + {"name": "tmq_topic_1", "sql": "select * from db.stb"} + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json/tmq_basic2.json b/tests/army/tools/benchmark/basic/json/tmq_basic2.json new file mode 100644 index 0000000000..5f61d6e7d3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/tmq_basic2.json @@ -0,0 +1,29 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "result_file": "./tmq_result.txt", + "tmq_info": { + "concurrent": 2, + "poll_delay": 3000, + "group.id": "", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.manual.commit": "true", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "true", + "rows_file": "./consumed_rows", + "expect_rows": -1, + "topic_list": [ + {"name": "tmq_topic_0", "sql": "select * from db.stb;"}, + {"name": "tmq_topic_1", "sql": "select * from db.stb"} + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json/tmq_basic3.json b/tests/army/tools/benchmark/basic/json/tmq_basic3.json new file mode 100644 index 0000000000..153754dd70 --- /dev/null +++ b/tests/army/tools/benchmark/basic/json/tmq_basic3.json @@ -0,0 +1,27 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "result_file": "./tmq_result.txt", + "tmq_info": { + "concurrent": 2, + "poll_delay": 3000, + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "true", + "rows_file": "./consumed_rows", + "expect_rows": -1, + "topic_list": [ + {"name": "tmq_topic_0", "sql": "select * from db.stb;"}, + {"name": "tmq_topic_1", "sql": "select * from db.stb"} + ] + } +} diff --git a/tests/army/tools/benchmark/basic/json_tag.py b/tests/army/tools/benchmark/basic/json_tag.py new file mode 100644 index 0000000000..eced914eba --- /dev/null +++ b/tests/army/tools/benchmark/basic/json_tag.py @@ -0,0 +1,76 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_json_tag.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkData(2, 0, "jtag") + tdSql.checkData(2, 1, "JSON") + tdSql.checkData(2, 3, "TAG") + # cannot count in 3.0 + # tdSql.query("select count(jtag) from db.stb") + # tdSql.checkData(0, 0, 8) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/limit_offset_json.py b/tests/army/tools/benchmark/basic/limit_offset_json.py new file mode 100644 index 0000000000..d35af35bc6 --- /dev/null +++ b/tests/army/tools/benchmark/basic/limit_offset_json.py @@ -0,0 +1,126 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_only_create_table.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + + # tdSql.query("select * from db.stb") + # dbresult = tdSql.queryResult + # print(dbresult) + # if dbresult != []: + # for i in range(len(dbresult[0])): + # if i in (1, 2) and dbresult[0][i] == None: + # tdLog.exit("result[0][%d] is NULL, which should not be" % i) + # else: + # tdLog.info("result[0][{0}] is {1}".format(i, dbresult[0][i])) + + # Shuduo: temporary disable check count() from db.stb + # tdSql.query("select count(*) from db.stb") + # tdSql.checkRows(0) + tdSql.query("describe db.stb") + tdSql.checkData(9, 1, "NCHAR") + # varchar in 3.0 but binary in 2.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(23, 1, "NCHAR") + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(9, 2, 64) + tdSql.checkData(14, 2, 64) + tdSql.checkData(23, 2, 64) + tdSql.checkData(28, 2, 64) + + cmd = "%s -f ./taosbenchmark/json/taosc_limit_offset.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 40) + tdSql.query("select distinct(c3) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c4) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c5) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c6) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c7) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c8) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c9) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c10) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c11) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c12) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c13) from db.stb") + tdSql.checkData(0, 0, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py b/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py new file mode 100644 index 0000000000..cc2075c8ff --- /dev/null +++ b/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py @@ -0,0 +1,88 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = ( + "%s -b binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar -t 2 -n 50000 -I stmt -y > /dev/null" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + cmd = 'taos -s "select * from test.meters limit 1000000 offset 0" > /dev/null &' + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + cmd = "%s -f ./taosbenchmark/json/taosc_query-kill-slow-query.json" % binPath + tdLog.info("%s" % cmd) + output = subprocess.check_output(cmd, shell=True).decode("utf-8") + if "KILL QUERY" not in output: + tdLog.info(output) + tdLog.exit("KILL QUERY failed") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py b/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py new file mode 100644 index 0000000000..b5f30981e2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py @@ -0,0 +1,84 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + os.system( + "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" + ) + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + tdSql.execute("use db") + tdSql.execute("create table stb (ts timestamp, c0 int) tags (t0 int)") + tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)") + tdSql.execute("insert into stb_1 using stb tags (1) values (now, 1)") + tdSql.execute("insert into stb_2 using stb tags (2) values (now, 2)") + cmd = "%s -f ./taosbenchmark/json/taosc_query-error-sqlfile.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + # with open("%s" % "taosc_query_specified-sqlfile-0", "r+") as f1: + # for line in f1.readlines(): + # queryTaosc = line.strip().split()[0] + # assert queryTaosc == "3", "result is %s != expect: 3" % queryTaosc + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py b/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py new file mode 100644 index 0000000000..cf3d8649f7 --- /dev/null +++ b/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py @@ -0,0 +1,84 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + os.system( + "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" + ) + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + tdSql.execute("use db") + tdSql.execute("create table stb (ts timestamp, c0 int) tags (t0 int)") + tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)") + tdSql.execute("insert into stb_1 using stb tags (1) values (now, 1)") + tdSql.execute("insert into stb_2 using stb tags (2) values (now, 2)") + cmd = "%s -f ./taosbenchmark/json/taosc_query-sqlfile.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + # with open("%s" % "taosc_query_specified-sqlfile-0", "r+") as f1: + # for line in f1.readlines(): + # queryTaosc = line.strip().split()[0] + # assert queryTaosc == "3", "result is %s != expect: 3" % queryTaosc + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/query_json.py b/tests/army/tools/benchmark/basic/query_json.py new file mode 100644 index 0000000000..edc43237ce --- /dev/null +++ b/tests/army/tools/benchmark/basic/query_json.py @@ -0,0 +1,129 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import ast +import os +import re + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + os.system( + "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" + ) + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + tdSql.execute("use db") + tdSql.execute("create table stb (ts timestamp, c0 int) tags (t0 int)") + tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)") + tdSql.execute("insert into stb_1 using stb tags (1) values (now, 1)") + tdSql.execute("insert into stb_2 using stb tags (2) values (now, 2)") + cmd = "%s -f ./taosbenchmark/json/taosc_query.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + with open("%s" % "taosc_query_specified-0", "r+") as f1: + for line in f1.readlines(): + queryTaosc = line.strip().split()[0] + assert queryTaosc == "3", "result is %s != expect: 3" % queryTaosc + + with open("%s" % "taosc_query_super-0", "r+") as f1: + for line in f1.readlines(): + queryTaosc = line.strip().split()[0] + assert queryTaosc == "1", "result is %s != expect: 1" % queryTaosc + + cmd = "%s -f ./taosbenchmark/json/rest_query.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + times = 0 + with open("rest_query_super-0", "r+") as f1: + for line in f1.readlines(): + contents = line.strip() + if contents.find("data") != -1: + pattern = re.compile("{.*}") + contents = pattern.search(contents).group() + contentsDict = ast.literal_eval(contents) + queryResultRest = contentsDict["data"][0][0] + assert queryResultRest == 1, ( + "result is %s != expect: 1" % queryResultRest + ) + times += 1 + + assert times == 3, "result is %s != expect: 3" % times + + times = 0 + with open("rest_query_specified-0", "r+") as f1: + for line in f1.readlines(): + contents = line.strip() + if contents.find("data") != -1: + pattern = re.compile("{.*}") + contents = pattern.search(contents).group() + contentsDict = ast.literal_eval(contents) + queryResultRest = contentsDict["data"][0][0] + assert queryResultRest == 3, ( + "result is %s != expect: 3" % queryResultRest + ) + times += 1 + + assert times == 1, "result is %s != expect: 1" % times + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py new file mode 100644 index 0000000000..a263b350bc --- /dev/null +++ b/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py @@ -0,0 +1,110 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/rest_insert_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 160) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkRows(29) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "TIMESTAMP") + tdSql.checkData(2, 1, "INT") + tdSql.checkData(3, 1, "BIGINT") + tdSql.checkData(4, 1, "FLOAT") + tdSql.checkData(5, 1, "DOUBLE") + tdSql.checkData(6, 1, "SMALLINT") + tdSql.checkData(7, 1, "TINYINT") + tdSql.checkData(8, 1, "BOOL") + tdSql.checkData(9, 1, "NCHAR") + tdSql.checkData(9, 2, 29) + tdSql.checkData(10, 1, "INT UNSIGNED") + tdSql.checkData(11, 1, "BIGINT UNSIGNED") + tdSql.checkData(12, 1, "TINYINT UNSIGNED") + tdSql.checkData(13, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(14, 2, 23) + tdSql.checkData(15, 1, "TIMESTAMP") + tdSql.checkData(16, 1, "INT") + tdSql.checkData(17, 1, "BIGINT") + tdSql.checkData(18, 1, "FLOAT") + tdSql.checkData(19, 1, "DOUBLE") + tdSql.checkData(20, 1, "SMALLINT") + tdSql.checkData(21, 1, "TINYINT") + tdSql.checkData(22, 1, "BOOL") + tdSql.checkData(23, 1, "NCHAR") + tdSql.checkData(23, 2, 17) + tdSql.checkData(24, 1, "INT UNSIGNED") + tdSql.checkData(25, 1, "BIGINT UNSIGNED") + tdSql.checkData(26, 1, "TINYINT UNSIGNED") + tdSql.checkData(27, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(28, 2, 19) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/reuse-exist-stb.py b/tests/army/tools/benchmark/basic/reuse-exist-stb.py new file mode 100644 index 0000000000..cc49570aa5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/reuse-exist-stb.py @@ -0,0 +1,92 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-22190] taosBenchmark reuse exist stb test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + tdSql.execute("use db") + tdSql.execute("create table stb (ts timestamp, c0 int) tags (t0 int)") + tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)") + # sys.exit(0) + cmd = "%s -f ./taosbenchmark/json/reuse-exist-stb.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.new_0") + tdSql.checkData(0, 0, 5) + tdSql.query("select count(*) from db.stb_0") + tdSql.checkData(0, 0, 1) + + if major_ver == "3": + tdSql.query("select count(*) from (select distinct(tbname) from db.stb)") + else: + tdSql.query("select count(tbname) from db.stb") + tdSql.checkData(0, 0, 2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py b/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py new file mode 100644 index 0000000000..d3daaa04ac --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py @@ -0,0 +1,78 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/sml_auto_create_table.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db.stb4") + tdSql.checkData(0, 0, 160) + + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.`stb4-2`") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py new file mode 100644 index 0000000000..8e7cce3b69 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py @@ -0,0 +1,107 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/sml_insert_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 160) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkRows(27) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "INT") + tdSql.checkData(2, 1, "BIGINT") + tdSql.checkData(3, 1, "FLOAT") + tdSql.checkData(4, 1, "DOUBLE") + tdSql.checkData(5, 1, "SMALLINT") + tdSql.checkData(6, 1, "TINYINT") + tdSql.checkData(7, 1, "BOOL") + tdSql.checkData(8, 1, "NCHAR") + # sml nchar and binary length will auto changed in 3.0 + # tdSql.checkData(8, 2, 32) + tdSql.checkData(9, 1, "INT UNSIGNED") + tdSql.checkData(10, 1, "BIGINT UNSIGNED") + tdSql.checkData(11, 1, "TINYINT UNSIGNED") + tdSql.checkData(12, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(13, 1, "BINARY") + # sml nchar and binary length will auto changed in 3.0 + # tdSql.checkData(13, 2, 32) + tdSql.checkData(14, 1, "NCHAR") + tdSql.checkData(15, 1, "NCHAR") + tdSql.checkData(16, 1, "NCHAR") + tdSql.checkData(17, 1, "NCHAR") + tdSql.checkData(18, 1, "NCHAR") + tdSql.checkData(19, 1, "NCHAR") + tdSql.checkData(20, 1, "NCHAR") + tdSql.checkData(21, 1, "NCHAR") + tdSql.checkData(22, 1, "NCHAR") + tdSql.checkData(23, 1, "NCHAR") + tdSql.checkData(24, 1, "NCHAR") + tdSql.checkData(25, 1, "NCHAR") + tdSql.checkData(26, 1, "NCHAR") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_interlace.py b/tests/army/tools/benchmark/basic/sml_interlace.py new file mode 100644 index 0000000000..a179cbe95e --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_interlace.py @@ -0,0 +1,92 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_interlace.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + if major_ver == "3": + tdSql.query("select count(*) from (select distinct(tbname) from db.stb1)") + else: + tdSql.query("select count(tbname) from db.stb1") + tdSql.checkData(0, 0, 8) + if major_ver == "3": + tdSql.query("select count(*) from (select distinct(tbname) from db.stb2)") + else: + tdSql.query("select count(tbname) from db.stb2") + tdSql.checkData(0, 0, 8) + tdSql.query("select count(*) from db.stb1") + result = tdSql.getData(0, 0) + assert result <= 160, "result is %s > expect: 160" % result + tdSql.query("select count(*) from db.stb2") + result = tdSql.getData(0, 0) + assert result <= 160, "result is %s > expect: 160" % result + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py b/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py new file mode 100644 index 0000000000..0dd7110aa5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py @@ -0,0 +1,124 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21932] taosBenchmark schemaless refine + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_json_alltypes-interlace.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb1") + tdSql.checkData(1, 1, "BOOL") + tdSql.query("describe db.stb2") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb3") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb4") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb5") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb6") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb7") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb8") + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 1, "NCHAR") + tdSql.checkData(1, 2, 8) + + tdSql.query("describe db.stb9") + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 2, 8) + tdSql.checkData(1, 1, "NCHAR") + + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb4") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb5") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb6") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb7") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb8") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb9") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_json_alltypes.py b/tests/army/tools/benchmark/basic/sml_json_alltypes.py new file mode 100644 index 0000000000..c46797f420 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_json_alltypes.py @@ -0,0 +1,124 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_json_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb1") + tdSql.checkData(1, 1, "BOOL") + tdSql.query("describe db.stb2") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb3") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb4") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb5") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb6") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb7") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb8") + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 1, "NCHAR") + tdSql.checkData(1, 2, 8) + + tdSql.query("describe db.stb9") + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 1, "NCHAR") + tdSql.checkData(1, 2, 8) + + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb4") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb5") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb6") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb7") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb8") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb9") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py new file mode 100644 index 0000000000..e345fbd3b5 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py @@ -0,0 +1,103 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-23292] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/sml_json_insert_alltypes-same-min-max.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.stb") + rows = tdSql.queryResult[0] + tdSql.query("select * from db.stb") + for row in range(rows[0]): + if major_ver == "3": + tdSql.checkData(row, 1, 1.0) + tdSql.checkData(row, 2, 1.0) + tdSql.checkData(row, 4, 1.0) + tdSql.checkData(row, 5, 1.0) + tdSql.checkData(row, 6, 1.0) + tdSql.checkData(row, 7, 1.0) + tdSql.checkData(row, 11, 30.0) + tdSql.checkData(row, 12, 60000.0) + else: + tdSql.checkData(row, 1, 1.0) + tdSql.checkData(row, 2, 1.0) + tdSql.checkData(row, 3, 60000.0) + tdSql.checkData(row, 5, 1.0) + tdSql.checkData(row, 6, 1.0) + tdSql.checkData(row, 7, 1.0) + tdSql.checkData(row, 8, 1.0) + tdSql.checkData(row, 12, 30.0) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py b/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py new file mode 100644 index 0000000000..7870a44fc7 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py @@ -0,0 +1,124 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +def getPath(tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21932] taosBenchmark sml test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = getPath() + cmd = "%s -f ./taosbenchmark/json/sml_taosjson_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb1") + tdSql.checkData(1, 1, "BOOL") + tdSql.query("describe db.stb2") + tdSql.checkData(1, 1, "TINYINT") + tdSql.query("describe db.stb3") + tdSql.checkData(1, 1, "SMALLINT") + tdSql.query("describe db.stb4") + tdSql.checkData(1, 1, "INT") + tdSql.query("describe db.stb5") + tdSql.checkData(1, 1, "BIGINT") + tdSql.query("describe db.stb6") + tdSql.checkData(1, 1, "FLOAT") + tdSql.query("describe db.stb7") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb8") + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 1, "BINARY") + tdSql.checkData(1, 2, 8) + + tdSql.query("describe db.stb9") + tdSql.checkData(1, 1, "NCHAR") + if major_ver == "3": + tdSql.checkData(1, 2, 16) + else: + tdSql.checkData(1, 2, 8) + + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb4") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb5") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb6") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb7") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb8") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb9") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py new file mode 100644 index 0000000000..8edf34fe33 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py @@ -0,0 +1,87 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-23292] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/sml_taosjson_insert_alltypes-same-min-max.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.stb") + rows = tdSql.queryResult[0] + tdSql.query("select * from db.stb") + for row in range(rows[0]): + tdSql.checkData(row, 3, 1) + tdSql.checkData(row, 4, 3000000000) + tdSql.checkData(row, 5, 1.0) + tdSql.checkData(row, 6, 1.0) + tdSql.checkData(row, 7, 1) + tdSql.checkData(row, 8, 1) + tdSql.checkData(row, 9, True) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py b/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py new file mode 100644 index 0000000000..cea2fa1fc2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py @@ -0,0 +1,142 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_telnet_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb1") + tdSql.checkData(1, 1, "BOOL") + tdSql.query("describe db.stb2") + tdSql.checkData(1, 1, "TINYINT") + tdSql.query("describe db.stb3") + tdSql.checkData(1, 1, "TINYINT UNSIGNED") + tdSql.query("describe db.stb4") + tdSql.checkData(1, 1, "SMALLINT") + tdSql.query("describe db.stb5") + tdSql.checkData(1, 1, "SMALLINT UNSIGNED") + tdSql.query("describe db.stb6") + tdSql.checkData(1, 1, "INT") + tdSql.query("describe db.stb7") + tdSql.checkData(1, 1, "INT UNSIGNED") + tdSql.query("describe db.stb8") + tdSql.checkData(1, 1, "BIGINT") + tdSql.query("describe db.stb9") + tdSql.checkData(1, 1, "BIGINT UNSIGNED") + tdSql.query("describe db.stb10") + tdSql.checkData(1, 1, "FLOAT") + tdSql.query("describe db.stb11") + tdSql.checkData(1, 1, "DOUBLE") + tdSql.query("describe db.stb12") + + if major_ver == "3": + tdSql.checkData(1, 1, "VARCHAR") + tdSql.checkData( + 1, 2, 8 + ) # 3.0 will use a bit more space for schemaless create table + else: + tdSql.checkData(1, 1, "BINARY") + tdSql.checkData(1, 2, 8) + + tdSql.query("describe db.stb13") + tdSql.checkData(1, 1, "NCHAR") + if major_ver == "3": + tdSql.checkData(1, 2, 8) + else: + tdSql.checkData(1, 2, 8) + + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb3") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb4") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb5") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb6") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb7") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb8") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb9") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb11") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb12") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb13") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py new file mode 100644 index 0000000000..e1ec7d998e --- /dev/null +++ b/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py @@ -0,0 +1,110 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-23292] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/sml_telnet_insert_alltypes-same-min-max.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.stb") + rows = tdSql.queryResult[0] + tdSql.query("select * from db.stb") + for row in range(rows[0]): + if major_ver == "3": + tdSql.checkData(row, 1, 1) + tdSql.checkData(row, 2, "1i32") + tdSql.checkData(row, 3, "3000000000i64") + tdSql.checkData(row, 4, "1.000000f32") + tdSql.checkData(row, 5, "1.000000f64") + tdSql.checkData(row, 6, "1i16") + tdSql.checkData(row, 7, "1i8") + tdSql.checkData(row, 8, "true") + tdSql.checkData(row, 9, "4000000000u32") + tdSql.checkData(row, 10, "5000000000u64") + tdSql.checkData(row, 11, "30u8") + tdSql.checkData(row, 12, "60000u16") + else: + tdSql.checkData(row, 1, 1) + tdSql.checkData(row, 2, "1i32") + tdSql.checkData(row, 3, "60000u16") + tdSql.checkData(row, 4, "3000000000i64") + tdSql.checkData(row, 5, "1.000000f32") + tdSql.checkData(row, 6, "1.000000f64") + tdSql.checkData(row, 7, "1i16") + tdSql.checkData(row, 8, "1i8") + tdSql.checkData(row, 9, "true") + tdSql.checkData(row, 10, "4000000000u32") + tdSql.checkData(row, 11, "5000000000u64") + tdSql.checkData(row, 12, "30u8") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt2_insert.py b/tests/army/tools/benchmark/basic/stmt2_insert.py new file mode 100644 index 0000000000..a1f8f3bf10 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt2_insert.py @@ -0,0 +1,108 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import json +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def testBenchmarkJson(self, benchmark, jsonFile): + # exe insert + cmd = f"{benchmark} -f {jsonFile}" + os.system(cmd) + + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + db = data["databases"][0]["dbinfo"]["name"] + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + tdLog.info(f"get json info: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + + def run(self): + benchmark = self.getPath() + ''' stmt2 engine have some problem + # batch - auto-create-table(yes or no) + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_batch_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_batch_autoctb_no.json") + # interlace - auto-create-table(yes or no) + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_interlace_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_interlace_autoctb_no.json") + # csv - (batch or interlace) + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_csv_interlace_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_csv_batch_autoctb_no.json") + ''' + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py b/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py new file mode 100644 index 0000000000..baab1b4cc3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py @@ -0,0 +1,78 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/stmt_auto_create_table.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.`stb2-2`") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py new file mode 100644 index 0000000000..50adc0f053 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py @@ -0,0 +1,91 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-23292] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/stmt_insert_alltypes-same-min-max.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.t0") + rows = tdSql.queryResult[0] + tdSql.query("select * from db.t0") + for row in range(rows[0]): + tdSql.checkData(row, 1, 1) + tdSql.checkData(row, 2, 3000000000) + tdSql.checkData(row, 3, 1.0) + tdSql.checkData(row, 4, 1.0) + tdSql.checkData(row, 5, 1) + tdSql.checkData(row, 6, 1) + tdSql.checkData(row, 7, True) + tdSql.checkData(row, 8, 4000000000) + tdSql.checkData(row, 9, 5000000000) + tdSql.checkData(row, 10, 30) + tdSql.checkData(row, 11, 60000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py new file mode 100644 index 0000000000..11617db7b2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py @@ -0,0 +1,165 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + + cmd = "%s -f ./taosbenchmark/json/stmt_insert_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 160) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkRows(29) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "TIMESTAMP") + tdSql.checkData(2, 1, "INT") + tdSql.checkData(3, 1, "BIGINT") + tdSql.checkData(4, 1, "FLOAT") + tdSql.checkData(5, 1, "DOUBLE") + tdSql.checkData(6, 1, "SMALLINT") + tdSql.checkData(7, 1, "TINYINT") + tdSql.checkData(8, 1, "BOOL") + tdSql.checkData(9, 1, "NCHAR") + tdSql.checkData(9, 2, 29) + tdSql.checkData(10, 1, "INT UNSIGNED") + tdSql.checkData(11, 1, "BIGINT UNSIGNED") + tdSql.checkData(12, 1, "TINYINT UNSIGNED") + tdSql.checkData(13, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(14, 2, 23) + tdSql.checkData(15, 1, "TIMESTAMP") + tdSql.checkData(16, 1, "INT") + tdSql.checkData(17, 1, "BIGINT") + tdSql.checkData(18, 1, "FLOAT") + tdSql.checkData(19, 1, "DOUBLE") + tdSql.checkData(20, 1, "SMALLINT") + tdSql.checkData(21, 1, "TINYINT") + tdSql.checkData(22, 1, "BOOL") + tdSql.checkData(23, 1, "NCHAR") + tdSql.checkData(23, 2, 17) + tdSql.checkData(24, 1, "INT UNSIGNED") + tdSql.checkData(25, 1, "BIGINT UNSIGNED") + tdSql.checkData(26, 1, "TINYINT UNSIGNED") + tdSql.checkData(27, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(28, 2, 19) + tdSql.query("select count(*) from db.stb where c0 >= 0 and c0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c1 >= 0 and c1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c2 >= 0 and c2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c3 >= 0 and c3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c4 >= 0 and c4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c5 >= 0 and c5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c6 >= 0 and c6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c8 like 'd1%' or c8 like 'd2%'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c9 >= 0 and c9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c10 >= 0 and c10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c11 >= 0 and c11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c12 >= 0 and c12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query( + "select count(*) from db.stb where c13 like 'b1%' or c13 like 'b2%'" + ) + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t0 >= 0 and t0 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t1 >= 0 and t1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t2 >= 0 and t2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t3 >= 0 and t3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t4 >= 0 and t4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t5 >= 0 and t5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t6 >= 0 and t6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t8 like 'd1%' or t8 like 'd2%'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t9 >= 0 and t9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t10 >= 0 and t10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t11 >= 0 and t11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t12 >= 0 and t12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query( + "select count(*) from db.stb where t13 like 'b1%' or t13 like 'b2%'" + ) + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_offset_json.py b/tests/army/tools/benchmark/basic/stmt_offset_json.py new file mode 100644 index 0000000000..a15a65b0d0 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_offset_json.py @@ -0,0 +1,126 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TS-3060] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_only_create_table.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + + # tdSql.query("select * from db.stb") + # dbresult = tdSql.queryResult + # print(dbresult) + # if dbresult != []: + # for i in range(len(dbresult[0])): + # if i in (1, 2) and dbresult[0][i] == None: + # tdLog.exit("result[0][%d] is NULL, which should not be" % i) + # else: + # tdLog.info("result[0][{0}] is {1}".format(i, dbresult[0][i])) + + # Shuduo: temporary disable check count() from db.stb + # tdSql.query("select count(*) from db.stb") + # tdSql.checkRows(0) + tdSql.query("describe db.stb") + tdSql.checkData(9, 1, "NCHAR") + # varchar in 3.0 but binary in 2.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(23, 1, "NCHAR") + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(9, 2, 64) + tdSql.checkData(14, 2, 64) + tdSql.checkData(23, 2, 64) + tdSql.checkData(28, 2, 64) + + cmd = "%s -f ./taosbenchmark/json/stmt_limit_offset.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 40) + tdSql.query("select distinct(c3) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c4) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c5) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c6) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c7) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c8) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c9) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c10) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c11) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c12) from db.stb") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c13) from db.stb") + tdSql.checkData(0, 0, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py new file mode 100644 index 0000000000..1f63d12386 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py @@ -0,0 +1,102 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/stmt_sample_use_ts-subtable.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 32) + tdSql.query("select * from db.stb0") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + tdSql.checkData(2, 1, 3) + tdSql.checkData(3, 1, None) + + tdSql.query("select * from db.stb3") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 300) + tdSql.checkData(1, 1, 600) + tdSql.checkData(2, 1, 900) + tdSql.checkData(3, 1, None) + + tdSql.query("select * from db.stb5") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 500) + tdSql.checkData(1, 1, 1000) + tdSql.checkData(2, 1, 1500) + tdSql.checkData(3, 1, None) + + tdSql.query("select distinct(t0) from db.stb") + tdSql.checkRows(2) + + dbresult = tdSql.queryResult + if dbresult[0][0] not in (17, None): + tdLog.exit("result[0][0]: {}".format(dbresult[0][0])) + else: + tdLog.info("result[0][0]: {}".format(dbresult[0][0])) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py new file mode 100644 index 0000000000..f956fbeeac --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py @@ -0,0 +1,87 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/stmt_sample_use_ts.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 32) + tdSql.query("select * from db.stb_0") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + tdSql.checkData(2, 1, 3) + tdSql.checkData(3, 1, None) + tdSql.query("select distinct(t0) from db.stb") + tdSql.checkRows(2) + + dbresult = tdSql.queryResult + if dbresult[0][0] not in (17, None): + tdLog.exit("result[0][0]: {}".format(dbresult[0][0])) + else: + tdLog.info("result[0][0]: {}".format(dbresult[0][0])) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py new file mode 100644 index 0000000000..964d5a4282 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py @@ -0,0 +1,87 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/stmt_sample_doesnt_use_ts.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 80) + tdSql.query("select * from db.stb_0") + tdSql.checkRows(10) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + tdSql.checkData(2, 1, 3) + tdSql.checkData(3, 1, None) + tdSql.query("select distinct(t0) from db.stb") + tdSql.checkRows(2) + + dbresult = tdSql.queryResult + if dbresult[0][0] not in (17, None): + tdLog.exit("result[0][0]: {}".format(dbresult[0][0])) + else: + tdLog.info("result[0][0]: {}".format(dbresult[0][0])) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stream-test.py b/tests/army/tools/benchmark/basic/stream-test.py new file mode 100644 index 0000000000..84941e66c3 --- /dev/null +++ b/tests/army/tools/benchmark/basic/stream-test.py @@ -0,0 +1,73 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21047] taosBenchmark stream test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/stream-test.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(10) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 100) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/stream_function_test.py b/tests/army/tools/benchmark/basic/stream_function_test.py new file mode 100644 index 0000000000..90c33c608f --- /dev/null +++ b/tests/army/tools/benchmark/basic/stream_function_test.py @@ -0,0 +1,76 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-21047] taosBenchmark stream test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/stream_exist_stb_tag_prepare.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + cmd = "%s -f ./taosbenchmark/json/stream_exist_stb_tag_insert_partition.json " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from stream_test.stb") + tdSql.checkData(0, 0, 100000) + tdSql.query("select count(*) from stream_test.output_streamtb;") + tdSql.checkEqual(tdSql.queryResult[0][0] >= 0, True) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosadapter_json.py b/tests/army/tools/benchmark/basic/taosadapter_json.py new file mode 100644 index 0000000000..7f1c31fce8 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosadapter_json.py @@ -0,0 +1,99 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_rest_telnet.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.execute("use db") + tdSql.query("show tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb2") + tdSql.checkData(0, 0, 160) + + cmd = "%s -f ./taosbenchmark/json/sml_rest_line.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.execute("use db2") + tdSql.query("show tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db2.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db2.stb2") + tdSql.checkData(0, 0, 160) + + cmd = "%s -f ./taosbenchmark/json/sml_rest_json.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.execute("use db3") + tdSql.query("show tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db3.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db3.stb2") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py b/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py new file mode 100644 index 0000000000..cb11b2b5e2 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py @@ -0,0 +1,127 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_auto_create_table.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(16) + tdSql.query("select count(*) from db.stb1") + tdSql.checkData(0, 0, 160) + tdSql.query("select distinct(c5) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c6) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c7) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c8) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c9) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c10) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c11) from db.stb1") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c12) from db.stb1") + tdSql.checkData(0, 0, None) + + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.`stb1-2`") + tdSql.checkData(0, 0, 160) + tdSql.query("select distinct(c5) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c6) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c7) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c8) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c9) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c10) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c11) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + tdSql.query("select distinct(c12) from db.`stb1-2`") + tdSql.checkData(0, 0, None) + + if major_ver == "3": + tdSql.query( + "select `ttl` from information_schema.ins_tables where db_name = 'db' and table_name like 'stb\_%' limit 1" + ) + tdSql.checkData(0, 0, 360) + + tdSql.query( + "select `ttl` from information_schema.ins_tables where db_name = 'db' and table_name like 'stb1-%' limit 1" + ) + tdSql.checkData(0, 0, 180) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-mix.py b/tests/army/tools/benchmark/basic/taosc_insert-mix.py new file mode 100644 index 0000000000..e40a6a4d77 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert-mix.py @@ -0,0 +1,85 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + taosBenchmark insert mix data + """ + + @classmethod + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + @classmethod + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + @classmethod + def run(self): + binPath = self.getPath() + # mix 1 ~ 4 + for i in range(4): + cmd = "%s -f ./taosbenchmark/json/case-insert-mix%d.json" % (binPath, i + 1) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + psCmd = "ps -ef|grep -w taosBenchmark| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + + while processID: + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdSql.query("select count(*) from mix1.meters") + + @classmethod + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py new file mode 100644 index 0000000000..1608e33223 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py @@ -0,0 +1,85 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19985] taosBenchmark retry test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_insert_retry-global.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(2) + tdDnodes.stopAll() + time.sleep(2) + tdDnodes.start(1) + time.sleep(2) + + psCmd = "ps -ef|grep -w taosBenchmark| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + + while processID: + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py new file mode 100644 index 0000000000..fba50f296e --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py @@ -0,0 +1,85 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19985] taosBenchmark retry test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_insert_retry-stb.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(2) + tdDnodes.stopAll() + time.sleep(2) + tdDnodes.start(1) + time.sleep(2) + + psCmd = "ps -ef|grep -w taosBenchmark| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + + while processID: + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py b/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py new file mode 100644 index 0000000000..65eef2173c --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py @@ -0,0 +1,89 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-19449] taosBenchmark creating table interval test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/taosc_insert_table-creating-interval.json -g 2>&1| grep sleep | wc -l" + % binPath + ) + tdLog.info("%s" % cmd) + + sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8") + + if int(sleepTimes) != 8: + tdLog.exit("expected sleep times 4, actual %d" % int(sleepTimes)) + + if major_ver == "3": + tdSql.query( + "select count(*) from (select distinct(tbname) from test.meters)" + ) + else: + tdSql.query("select count(tbname) from test.meters") + tdSql.checkData(0, 0, 20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py new file mode 100644 index 0000000000..8bb2b30c00 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py @@ -0,0 +1,91 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-23292] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/taosc_insert_alltypes-same-min-max.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("select count(*) from db.t0") + rows = tdSql.queryResult[0] + tdSql.query("select * from db.t0") + for row in range(rows[0]): + tdSql.checkData(row, 1, 1) + tdSql.checkData(row, 2, 3000000000) + tdSql.checkData(row, 3, 1.0) + tdSql.checkData(row, 4, 1.0) + tdSql.checkData(row, 5, 1) + tdSql.checkData(row, 6, 1) + tdSql.checkData(row, 7, True) + tdSql.checkData(row, 8, 4000000000) + tdSql.checkData(row, 9, 5000000000) + tdSql.checkData(row, 10, 30) + tdSql.checkData(row, 11, 60000) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py new file mode 100644 index 0000000000..2db3818709 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py @@ -0,0 +1,125 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = ( + "%s -f ./taosbenchmark/json/taosc_insert_alltypes-partial-col.json" + % binPath + ) + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 160) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkRows(29) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "TIMESTAMP") + tdSql.checkData(2, 1, "INT") + tdSql.checkData(3, 1, "BIGINT") + tdSql.checkData(4, 1, "FLOAT") + tdSql.checkData(5, 1, "DOUBLE") + tdSql.checkData(6, 1, "SMALLINT") + tdSql.checkData(7, 1, "TINYINT") + tdSql.checkData(8, 1, "BOOL") + tdSql.checkData(9, 1, "NCHAR") + tdSql.checkData(9, 2, 29) + tdSql.checkData(10, 1, "INT UNSIGNED") + tdSql.checkData(11, 1, "BIGINT UNSIGNED") + tdSql.checkData(12, 1, "TINYINT UNSIGNED") + tdSql.checkData(13, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(14, 2, 23) + tdSql.checkData(15, 1, "TIMESTAMP") + tdSql.checkData(16, 1, "INT") + tdSql.checkData(17, 1, "BIGINT") + tdSql.checkData(18, 1, "FLOAT") + tdSql.checkData(19, 1, "DOUBLE") + tdSql.checkData(20, 1, "SMALLINT") + tdSql.checkData(21, 1, "TINYINT") + tdSql.checkData(22, 1, "BOOL") + tdSql.checkData(23, 1, "NCHAR") + tdSql.checkData(23, 2, 17) + tdSql.checkData(24, 1, "INT UNSIGNED") + tdSql.checkData(25, 1, "BIGINT UNSIGNED") + tdSql.checkData(26, 1, "TINYINT UNSIGNED") + tdSql.checkData(27, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(28, 2, 19) + tdSql.query("select count(*) from db.stb where c1 >= 0 and c1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select c0,c1,c2 from db.stb limit 1") + dbresult = tdSql.queryResult + for i in range(len(dbresult[0])): + if i in (0, 1) and dbresult[0][i] is None: + tdLog.exit("result[0][%d] is NULL, which should not be" % i) + else: + tdLog.info("result[0][{0}] is {1}".format(i, dbresult[0][i])) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py new file mode 100644 index 0000000000..a2b1a88737 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py @@ -0,0 +1,170 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + tdLog.info("projPath: %s" % projPath) + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_insert_alltypes.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 160) + tdSql.execute("reset query cache") + tdSql.query("describe db.stb") + tdSql.checkRows(29) + tdSql.checkData(0, 1, "TIMESTAMP") + tdSql.checkData(1, 1, "TIMESTAMP") + tdSql.checkData(2, 1, "INT") + tdSql.checkData(3, 1, "BIGINT") + tdSql.checkData(4, 1, "FLOAT") + tdSql.checkData(5, 1, "DOUBLE") + tdSql.checkData(6, 1, "SMALLINT") + tdSql.checkData(7, 1, "TINYINT") + tdSql.checkData(8, 1, "BOOL") + tdSql.checkData(9, 1, "NCHAR") + tdSql.checkData(9, 2, 29) + tdSql.checkData(10, 1, "INT UNSIGNED") + tdSql.checkData(11, 1, "BIGINT UNSIGNED") + tdSql.checkData(12, 1, "TINYINT UNSIGNED") + tdSql.checkData(13, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(14, 1, "BINARY") + tdSql.checkData(14, 2, 23) + tdSql.checkData(15, 1, "TIMESTAMP") + tdSql.checkData(16, 1, "INT") + tdSql.checkData(17, 1, "BIGINT") + tdSql.checkData(18, 1, "FLOAT") + tdSql.checkData(19, 1, "DOUBLE") + tdSql.checkData(20, 1, "SMALLINT") + tdSql.checkData(21, 1, "TINYINT") + tdSql.checkData(22, 1, "BOOL") + tdSql.checkData(23, 1, "NCHAR") + tdSql.checkData(23, 2, 17) + tdSql.checkData(24, 1, "INT UNSIGNED") + tdSql.checkData(25, 1, "BIGINT UNSIGNED") + tdSql.checkData(26, 1, "TINYINT UNSIGNED") + tdSql.checkData(27, 1, "SMALLINT UNSIGNED") + # binary/varchar diff in 2.x/3.x + # tdSql.checkData(28, 1, "BINARY") + tdSql.checkData(28, 2, 19) + tdSql.query("select count(*) from db.stb where c1 >= 0 and c1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c2 >= 0 and c2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c3 >= 0 and c3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c4 >= 0 and c4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c5 >= 0 and c5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c6 >= 0 and c6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c8 = 'd1' or c8 = 'd2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c9 >= 0 and c9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c10 >= 0 and c10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c11 >= 0 and c11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c12 >= 0 and c12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where c13 = 'b1' or c13 = 'b2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t1 >= 0 and t1 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t2 >= 0 and t2 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t3 >= 0 and t3 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t4 >= 0 and t4 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t5 >= 0 and t5 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t6 >= 0 and t6 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t8 = 'd1' or t8 = 'd2'") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t9 >= 0 and t9 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t10 >= 0 and t10 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t11 >= 0 and t11 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t12 >= 0 and t12 <= 10") + tdSql.checkData(0, 0, 160) + tdSql.query("select count(*) from db.stb where t13 = 'b1' or t13 = 'b2'") + tdSql.checkData(0, 0, 160) + + if major_ver == "3": + tdSql.query( + "select `ttl` from information_schema.ins_tables where db_name = 'db' limit 1" + ) + tdSql.checkData(0, 0, 360) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py b/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py new file mode 100644 index 0000000000..a3b2c71c8e --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py @@ -0,0 +1,102 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_sample_use_ts-subtable.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 32) + tdSql.query("select * from db.stb0") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + tdSql.checkData(2, 1, 3) + tdSql.checkData(3, 1, None) + + tdSql.query("select * from db.stb3") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 300) + tdSql.checkData(1, 1, 600) + tdSql.checkData(2, 1, 900) + tdSql.checkData(3, 1, None) + + tdSql.query("select * from db.stb5") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 500) + tdSql.checkData(1, 1, 1000) + tdSql.checkData(2, 1, 1500) + tdSql.checkData(3, 1, None) + + tdSql.query("select distinct(t0) from db.stb") + tdSql.checkRows(2) + + dbresult = tdSql.queryResult + if dbresult[0][0] not in (17, None): + tdLog.exit("result[0][0]: {}".format(dbresult[0][0])) + else: + tdLog.info("result[0][0]: {}".format(dbresult[0][0])) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py b/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py new file mode 100644 index 0000000000..fe4e27e865 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py @@ -0,0 +1,87 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/taosc_sample_use_ts.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.query("show db.tables") + tdSql.checkRows(8) + tdSql.query("select count(*) from db.stb") + tdSql.checkData(0, 0, 32) + tdSql.query("select * from db.stb_0") + tdSql.checkRows(4) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + tdSql.checkData(2, 1, 3) + tdSql.checkData(3, 1, None) + tdSql.query("select distinct(t0) from db.stb") + tdSql.checkRows(2) + + dbresult = tdSql.queryResult + if dbresult[0][0] not in (17, None): + tdLog.exit("result[0][0]: {}".format(dbresult[0][0])) + else: + tdLog.info("result[0][0]: {}".format(dbresult[0][0])) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py b/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py new file mode 100644 index 0000000000..6aefcb5665 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py @@ -0,0 +1,226 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + # pylint: disable=R0201 + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosBenchmark not found!") + else: + tdLog.info("taosBenchmark use %s" % binPath) + + # insert: sample json + os.system("%s -f ./taosbenchmark/json/insert-sample-ts-stmt.json -y " % binPath) + tdSql.execute("use dbtest123") + tdSql.query("select c2 from stb0") + tdSql.checkData(0, 0, 2147483647) + if major_ver == "2": + tdSql.query("select c0 from stb0_0 order by ts") + tdSql.checkData(3, 0, 4) + tdSql.query("select count(*) from stb0 order by ts") + tdSql.checkData(0, 0, 40) + tdSql.query("select * from stb0_1 order by ts") + tdSql.checkData(0, 0, "2021-10-28 15:34:44.735") + tdSql.checkData(3, 0, "2021-10-31 15:34:44.735") + tdSql.query("select * from stb1 where t1=-127") + tdSql.checkRows(20) + tdSql.query("select * from stb1 where t2=127") + tdSql.checkRows(10) + tdSql.query("select * from stb1 where t2=126") + tdSql.checkRows(10) + + # insert: timestamp and step + os.system("%s -f ./taosbenchmark/json/insert-timestep-stmt.json -y " % binPath) + tdSql.execute("use db") + tdSql.query("show stables") + if major_ver == "3": + tdSql.query("select count (*) from (select distinct(tbname) from stb0)") + else: + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 10) + if major_ver == "3": + tdSql.query("select count (*) from (select distinct(tbname) from stb1)") + else: + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 20) + tdSql.query("select last(ts) from db.stb00_0") + tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000") + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 200) + tdSql.query("select last(ts) from db.stb01_0") + tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000") + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 400) + + # # insert: disorder_ratio + os.system( + "%s -f ./taosbenchmark/json/insert-disorder-stmt.json 2>&1 -y " % binPath + ) + tdSql.execute("use db") + if major_ver == "3": + tdSql.query("select count (*) from (select distinct(tbname) from stb0)") + else: + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 1) + if major_ver == "3": + tdSql.query("select count (*) from (select distinct(tbname) from stb1)") + else: + tdSql.query("select count (tbname) from stb1") + tdSql.checkData(0, 0, 1) + tdSql.query("select count(*) from stb0") + tdSql.checkData(0, 0, 10) + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 10) + + # insert: sample json + # os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-sample-stmt.json -y " % binPath) + # tdSql.execute("use dbtest123") + # tdSql.query("select c2 from stb0") + # tdSql.checkData(0, 0, 2147483647) + # tdSql.query("select * from stb1 where t1=-127") + # tdSql.checkRows(20) + # tdSql.query("select * from stb1 where t2=127") + # tdSql.checkRows(10) + # tdSql.query("select * from stb1 where t2=126") + # tdSql.checkRows(10) + + # insert: test interlace parament + os.system( + "%s -f ./taosbenchmark/json/insert-interlace-row-stmt.json -y " % binPath + ) + tdSql.execute("use db") + if major_ver == "3": + tdSql.query("select count (*) from (select distinct(tbname) from stb0)") + else: + tdSql.query("select count (tbname) from stb0") + tdSql.checkData(0, 0, 100) + tdSql.query("select count (*) from stb0") + tdSql.checkData(0, 0, 15000) + + # insert: auto_create + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db") + tdSql.execute("use db") + os.system( + "%s -y -f ./taosbenchmark/json/insert-drop-exist-auto-N00-stmt.json " + % binPath + ) # drop = no, child_table_exists, auto_create_table varies + tdSql.execute("use db") + tdSql.query( + "show tables like 'NN123%'" + ) # child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query( + "show tables like 'NNN%'" + ) # child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query( + "show tables like 'NNY%'" + ) # child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query( + "show tables like 'NYN%'" + ) # child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(0) + tdSql.query( + "show tables like 'NY123%'" + ) # child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(0) + tdSql.query( + "show tables like 'NYY%'" + ) # child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(0) + + tdSql.execute("drop database if exists db") + os.system( + "%s -y -f ./taosbenchmark/json/insert-drop-exist-auto-Y00-stmt.json " + % binPath + ) # drop = yes, child_table_exists, auto_create_table varies + tdSql.execute("use db") + tdSql.query( + "show tables like 'YN123%'" + ) # child_table_exists = no, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query( + "show tables like 'YNN%'" + ) # child_table_exists = no, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query( + "show tables like 'YNY%'" + ) # child_table_exists = no, auto_create_table varies = yes + tdSql.checkRows(20) + tdSql.query( + "show tables like 'YYN%'" + ) # child_table_exists = yes, auto_create_table varies = no + tdSql.checkRows(20) + tdSql.query( + "show tables like 'YY123%'" + ) # child_table_exists = yes, auto_create_table varies = 123 + tdSql.checkRows(20) + tdSql.query( + "show tables like 'YYY%'" + ) # child_table_exists = yes, auto_create_table varies = yes + tdSql.checkRows(20) + + os.system("rm -rf ./insert_res.txt") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py new file mode 100644 index 0000000000..0a4a14e1e1 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py @@ -0,0 +1,217 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import ast +import re + +# from assertpy import assert_that +import subprocess + + +class TDTestCase: + # pylint: disable=R0201 + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + # pylint: disable=R0201 + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 + def assertfileDataTaosc(self, filename, expectResult): + self.filename = filename + self.expectResult = expectResult + with open("%s" % filename, "r+") as f1: + for line in f1.readlines(): + queryResultTaosc = line.strip().split()[0] + self.assertCheck(filename, queryResultTaosc, expectResult) + + # 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。 + def getfileDataRestful(self, filename): + self.filename = filename + with open("%s" % filename, "r+") as f1: + for line in f1.readlines(): + contents = line.strip() + if contents.find("data") != -1: + pattern = re.compile("{.*}") + contents = pattern.search(contents).group() + contentsDict = ast.literal_eval(contents) # 字符串转换为字典 + queryResultRest = contentsDict["data"][0][0] + break + else: + queryResultRest = "" + return queryResultRest + + # 获取taosc接口查询次数 + def queryTimesTaosc(self, filename): + self.filename = filename + command = "cat %s |wc -l" % filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 获取restful接口查询次数 + def queryTimesRestful(self, filename): + self.filename = filename + command = 'cat %s |grep "200 OK" |wc -l' % filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 定义断言结果是否正确。不正确返回错误结果,正确即通过。 + def assertCheck(self, filename, queryResult, expectResult): + self.filename = filename + self.queryResult = queryResult + self.expectResult = expectResult + args0 = (filename, queryResult, expectResult) + assert queryResult == expectResult, ( + "Queryfile:%s ,result is %s != expect: %s" % args0 + ) + + def run(self): + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosBenchmark not found!") + else: + tdLog.info("taosBenchmark use %s" % binPath) + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # taosc query: query specified table and query super table + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + os.system("%s -f ./taosbenchmark/json/queryTaosc-mixed-query.json" % binPath) + os.system("cat query_res2.txt* > all_query_res2_taosc.txt") + + # correct Times testcases + + queryTimes2Taosc = self.queryTimesTaosc("all_query_res2_taosc.txt") + self.assertCheck("all_query_res2_taosc.txt", queryTimes2Taosc, 20) + + # correct data testcase + self.assertfileDataTaosc("all_query_res2_taosc.txt", "1604160000199") + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # use restful api to query + os.system("%s -f ./taosbenchmark/json/queryInsertrestdata.json" % binPath) + os.system("%s -f ./taosbenchmark/json/queryRestful.json" % binPath) + os.system("cat query_res2.txt* > all_query_res2_rest.txt") + + # correct Times testcases + + queryTimes2Restful = self.queryTimesRestful("all_query_res2_rest.txt") + self.assertCheck("all_query_res2_rest.txt", queryTimes2Restful, 4) + + # correct data testcase + + data2 = self.getfileDataRestful("all_query_res2_rest.txt") + print(data2) + if data2 != "2020-11-01 00:00:00.004" and data2 != "2020-10-31T16:00:00.004Z": + tdLog.exit( + "data2 is not 2020-11-01 00:00:00.004 and 2020-10-31T16:00:00.004Z" + ) + + # query times less than or equal to 100 + assert ( + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) == 0 + ) + assert ( + os.system("%s -f ./taosbenchmark/json/querySpeciMutisql100.json" % binPath) + != 0 + ) + assert ( + os.system("%s -f ./taosbenchmark/json/querySuperMutisql100.json" % binPath) + == 0 + ) + + # query result print QPS + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + exceptcode = os.system("%s -f ./taosbenchmark/json/queryQps.json" % binPath) + assert exceptcode == 0 + + # 2021.02.09 need modify taosBenchmakr code + # use illegal or out of range parameters query json file + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + # 2021.02.09 need modify taosBenchmakr code + # exceptcode = os.system( + # "%s -f ./taosbenchmark/json/queryTimes0.json" % + # binPath) + # assert exceptcode != 0 + + # 2021.02.09 need modify taosBenchmakr code + # exceptcode0 = os.system( + # "%s -f ./taosbenchmark/json/queryTimesless0.json" % + # binPath) + # assert exceptcode0 != 0 + + # exceptcode1 = os.system( + # "%s -f ./taosbenchmark/json/queryConcurrent0.json" % + # binPath) + # assert exceptcode2 != 0 + + # exceptcode3 = os.system( + # "%s -f ./taosbenchmark/json/querrThreadsless0.json" % + # binPath) + # assert exceptcode3 != 0 + + # exceptcode4 = os.system( + # "%s -f ./taosbenchmark/json/querrThreads0.json" % + # binPath) + # assert exceptcode4 != 0 + + # delete useless files + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf 5-taos-tools/taosbenchmark/*.py.sql") + os.system("rm -rf ./querySystemInfo*") + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # pylint: disable=R0201 + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py new file mode 100644 index 0000000000..b3341f2106 --- /dev/null +++ b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py @@ -0,0 +1,239 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import ast +import re + +# from assertpy import assert_that +import subprocess + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 + def assertfileDataTaosc(self, filename, expectResult): + self.filename = filename + self.expectResult = expectResult + with open("%s" % filename, "r+") as f1: + for line in f1.readlines(): + queryResultTaosc = line.strip().split()[0] + self.assertCheck(filename, queryResultTaosc, expectResult) + + # 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。 + def getfileDataRestful(self, filename): + self.filename = filename + with open("%s" % filename, "r+") as f1: + for line in f1.readlines(): + contents = line.strip() + if contents.find("data") != -1: + pattern = re.compile("{.*}") + contents = pattern.search(contents).group() + contentsDict = ast.literal_eval(contents) # 字符串转换为字典 + queryResultRest = contentsDict["data"][0][0] + break + else: + queryResultRest = "" + return queryResultRest + + # 获取taosc接口查询次数 + def queryTimesTaosc(self, filename): + self.filename = filename + command = "cat %s |wc -l" % filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 获取restful接口查询次数 + def queryTimesRestful(self, filename): + self.filename = filename + command = 'cat %s |grep "200 OK" |wc -l' % filename + times = int(subprocess.getstatusoutput(command)[1]) + return times + + # 定义断言结果是否正确。不正确返回错误结果,正确即通过。 + def assertCheck(self, filename, queryResult, expectResult): + self.filename = filename + self.queryResult = queryResult + self.expectResult = expectResult + args0 = (filename, queryResult, expectResult) + assert queryResult == expectResult, ( + "Queryfile:%s ,result is %s != expect: %s" % args0 + ) + + def run(self): + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosBenchmark not found!") + else: + tdLog.info("taosBenchmark use %s" % binPath) + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # taosc query: query specified table and query super table + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + os.system("%s -f ./taosbenchmark/json/queryTaosc.json" % binPath) + os.system("cat query_res0.txt* > all_query_res0_taosc.txt") + os.system("cat query_res1.txt* > all_query_res1_taosc.txt") + os.system("cat query_res2.txt* > all_query_res2_taosc.txt") + + # correct Times testcases + queryTimes0Taosc = self.queryTimesTaosc("all_query_res0_taosc.txt") + self.assertCheck("all_query_res0_taosc.txt", queryTimes0Taosc, 6) + + queryTimes1Taosc = self.queryTimesTaosc("all_query_res1_taosc.txt") + self.assertCheck("all_query_res1_taosc.txt", queryTimes1Taosc, 6) + + queryTimes2Taosc = self.queryTimesTaosc("all_query_res2_taosc.txt") + self.assertCheck("all_query_res2_taosc.txt", queryTimes2Taosc, 20) + + # correct data testcase + self.assertfileDataTaosc("all_query_res0_taosc.txt", "1604160000099") + self.assertfileDataTaosc("all_query_res1_taosc.txt", "100") + self.assertfileDataTaosc("all_query_res2_taosc.txt", "1604160000199") + + # delete useless files + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + + # use restful api to query + os.system("%s -f ./taosbenchmark/json/queryInsertrestdata.json" % binPath) + os.system("%s -f ./taosbenchmark/json/queryRestful.json" % binPath) + os.system("cat query_res0.txt* > all_query_res0_rest.txt") + os.system("cat query_res1.txt* > all_query_res1_rest.txt") + os.system("cat query_res2.txt* > all_query_res2_rest.txt") + + # correct Times testcases + queryTimes0Restful = self.queryTimesRestful("all_query_res0_rest.txt") + self.assertCheck("all_query_res0_rest.txt", queryTimes0Restful, 6) + + queryTimes1Restful = self.queryTimesRestful("all_query_res1_rest.txt") + self.assertCheck("all_query_res1_rest.txt", queryTimes1Restful, 6) + + queryTimes2Restful = self.queryTimesRestful("all_query_res2_rest.txt") + self.assertCheck("all_query_res2_rest.txt", queryTimes2Restful, 4) + + # correct data testcase + data0 = self.getfileDataRestful("all_query_res0_rest.txt") + if data0 != "2020-11-01 00:00:00.009" and data0 != "2020-10-31T16:00:00.009Z": + tdLog.exit( + "data0 is not 2020-11-01 00:00:00.009 and 2020-10-31T16:00:00.009Z" + ) + + data1 = self.getfileDataRestful("all_query_res1_rest.txt") + self.assertCheck("all_query_res1_rest.txt", data1, 10) + + data2 = self.getfileDataRestful("all_query_res2_rest.txt") + print(data2) + if data2 != "2020-11-01 00:00:00.004" and data2 != "2020-10-31T16:00:00.004Z": + tdLog.exit( + "data2 is not 2020-11-01 00:00:00.004 and 2020-10-31T16:00:00.004Z" + ) + + # query times less than or equal to 100 + assert ( + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) == 0 + ) + assert ( + os.system("%s -f ./taosbenchmark/json/querySpeciMutisql100.json" % binPath) + != 0 + ) + assert ( + os.system("%s -f ./taosbenchmark/json/querySuperMutisql100.json" % binPath) + == 0 + ) + + # query result print QPS + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + exceptcode = os.system("%s -f ./taosbenchmark/json/queryQps.json" % binPath) + assert exceptcode == 0 + + # 2021.02.09 need modify taosBenchmakr code + # use illegal or out of range parameters query json file + os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + # 2021.02.09 need modify taosBenchmakr code + # exceptcode = os.system( + # "%s -f ./taosbenchmark/json/queryTimes0.json" % + # binPath) + # assert exceptcode != 0 + + # 2021.02.09 need modify taosBenchmakr code + # exceptcode0 = os.system( + # "%s -f ./taosbenchmark/json/queryTimesless0.json" % + # binPath) + # assert exceptcode0 != 0 + + # exceptcode1 = os.system( + # "%s -f ./taosbenchmark/json/queryConcurrent0.json" % + # binPath) + # assert exceptcode2 != 0 + + # exceptcode3 = os.system( + # "%s -f ./taosbenchmark/json/querrThreadsless0.json" % + # binPath) + # assert exceptcode3 != 0 + + # exceptcode4 = os.system( + # "%s -f ./taosbenchmark/json/querrThreads0.json" % + # binPath) + # assert exceptcode4 != 0 + + # delete useless files + os.system("rm -rf ./insert_res.txt") + os.system("rm -rf 5-taos-tools/taosbenchmark/*.py.sql") + os.system("rm -rf ./querySystemInfo*") + os.system("rm -rf ./query_res*") + os.system("rm -rf ./all_query*") + os.system("rm -rf ./test_query_res0.txt") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/telnet_tcp.py b/tests/army/tools/benchmark/basic/telnet_tcp.py new file mode 100644 index 0000000000..e74088d493 --- /dev/null +++ b/tests/army/tools/benchmark/basic/telnet_tcp.py @@ -0,0 +1,97 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import time +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/sml_telnet_tcp.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(5) + tdSql.execute("reset query cache") + + if major_ver == "3": + tdSql.query( + "select count(*) from (select distinct(tbname) from opentsdb_telnet.stb1)" + ) + else: + tdSql.query("select count(tbname) from opentsdb_telnet.stb1") + tdSql.checkData(0, 0, 8) + tdSql.query("select count(*) from opentsdb_telnet.stb1") + tdSql.checkData(0, 0, 160) + if major_ver == "3": + tdSql.query( + "select count(*) from (select distinct(tbname) from opentsdb_telnet.stb2)" + ) + else: + tdSql.query("select count(tbname) from opentsdb_telnet.stb2") + tdSql.checkData(0, 0, 8) + tdSql.query("select count(*) from opentsdb_telnet.stb2") + tdSql.checkData(0, 0, 160) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/basic/tmq_case.py b/tests/army/tools/benchmark/basic/tmq_case.py new file mode 100644 index 0000000000..458b50c903 --- /dev/null +++ b/tests/army/tools/benchmark/basic/tmq_case.py @@ -0,0 +1,97 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import time +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-11510] taosBenchmark test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + tdSql.execute("drop topic if exists tmq_topic_0") + tdSql.execute("drop topic if exists tmq_topic_1") + binPath = self.getPath() + cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("alter database db WAL_RETENTION_PERIOD 3600000") + tdSql.execute("reset query cache") + cmd = "%s -f ./taosbenchmark/json/tmq_basic.json " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(5) + + cmd = "%s -f ./taosbenchmark/json/tmq_basic2.json " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(5) + cmd = "%s -f ./taosbenchmark/json/tmq_basic3.json " % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + time.sleep(5) +# try: +# for line in os.popen("ps ax | grep taosBenchmark | grep -v grep"): +# fields = line.split() + +# pid = fields[0] + +# os.kill(int(pid), signal.SIGINT) +# time.sleep(3) +# print("taosBenchmark be killed on purpose") +# except: +# tdLog.exit("failed to kill taosBenchmark") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/cloud/cloud-test.py b/tests/army/tools/benchmark/cloud/cloud-test.py new file mode 100644 index 0000000000..01a9fbf93a --- /dev/null +++ b/tests/army/tools/benchmark/cloud/cloud-test.py @@ -0,0 +1,84 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import os +import subprocess +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-22022] taosBenchmark cloud test cases + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.info(f"{tool} not found in {projPath}!") + return f"/usr/local/taos/bin/{tool}" + else: + tdLog.info(f"{tool} is found in {paths[0]}!") + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -T 1 -t 2 -n 10 -y" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + + ''' + taosPath = self.getPath("taos") + cmd = f"{taosPath} -s 'select count(*) from test.meters'" + tdLog.info(f"{cmd}") + cmdOutput = subprocess.check_output(cmd, shell=True).decode("utf-8") + tdLog.info(f"{cmdOutput}") + if "20 |" in cmdOutput: + tdLog.info("count of records is correct!") + else: + tdLog.exit("count of records is incorrect") + ''' + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/benchmark/ws/websocket.py b/tests/army/tools/benchmark/ws/websocket.py new file mode 100644 index 0000000000..af9a06f1d4 --- /dev/null +++ b/tests/army/tools/benchmark/ws/websocket.py @@ -0,0 +1,71 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + [TD-17079] taosBenchmark test cloud + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def getPath(self, tool="taosBenchmark"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def run(self): + binPath = self.getPath() + cmd = "%s -t 1 -n 1 -y -W http://localhost:6041 -D 30" % binPath + tdLog.info("%s" % cmd) + os.system("%s" % cmd) + tdSql.execute("reset query cache") + tdSql.execute("use test") + tdSql.query("select count(*) from test.meters") + tdSql.checkData(0, 0, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/json/geometry.json b/tests/army/tools/taosdump/native/json/geometry.json new file mode 100644 index 0000000000..57b34f5ebd --- /dev/null +++ b/tests/army/tools/taosdump/native/json/geometry.json @@ -0,0 +1,47 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 500, + "create_table_thread_count": 1, + "thread_count": 2, + "prepared_rand": 1000, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "geodb", + "drop": "yes", + "vgroups": 2, + "replica": 1, + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 1000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 10, + "start_timestamp":1600000000000, + "columns": [ + { "type": "int", "name": "ic", "min": 10, "max":10000 }, + { "type": "usmallint", "name": "usi" }, + { "type": "geometry", "name": "geo1", "len": 32}, + { "type": "geometry", "name": "geo2", "len": 100}, + { "type": "geometry", "name": "geo3", "len": 1024} + ], + "tags": [ + {"type": "geometry", "name": "tgeo1", "len":30}, + {"type": "geometry", "name": "tgeo2", "len":256} + ] + } + ] + } + ] +} diff --git a/tests/army/tools/taosdump/native/json/varbinary.json b/tests/army/tools/taosdump/native/json/varbinary.json new file mode 100644 index 0000000000..1dedc37954 --- /dev/null +++ b/tests/army/tools/taosdump/native/json/varbinary.json @@ -0,0 +1,47 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 500, + "create_table_thread_count": 1, + "thread_count": 2, + "prepared_rand": 1000, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "varbin", + "drop": "yes", + "vgroups": 2, + "replica": 1, + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 1000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 10, + "start_timestamp":1600000000000, + "columns": [ + { "type": "int", "name": "ic", "min": 10, "max":10000 }, + { "type": "usmallint", "name": "usi" }, + { "type": "varbinary", "name": "var1", "len": 10}, + { "type": "varbinary", "name": "var2", "len": 100}, + { "type": "varbinary", "name": "var3", "len": 1024} + ], + "tags": [ + {"type": "varbinary", "name": "tvar1", "len":25}, + {"type": "varbinary", "name": "tvar2", "len":256} + ] + } + ] + } + ] +} diff --git a/tests/army/tools/taosdump/native/taosdumpDbNtb.py b/tests/army/tools/taosdump/native/taosdumpDbNtb.py new file mode 100644 index 0000000000..d9f149f35e --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpDbNtb.py @@ -0,0 +1,138 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-18291] taosdump basic test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t1 -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1 -W db=newdb" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "newdb": + found = True + break + + assert found == True + + tdSql.execute("use newdb") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpDbStb.py b/tests/army/tools/taosdump/native/taosdumpDbStb.py new file mode 100644 index 0000000000..bdc3f89db7 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpDbStb.py @@ -0,0 +1,138 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-18291] taosdump basic test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db st -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1 -W db=newdb" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "newdb": + found = True + break + + assert found == True + + tdSql.execute("use newdb") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py new file mode 100644 index 0000000000..6bb7eb1db9 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py @@ -0,0 +1,140 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-20506] taosdump dump db with non-root + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + tdSql.execute("create user test pass '123456'") + + os.system("%s -utest -p123456 -D db -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1 -W db=newdb" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "newdb": + found = True + break + + assert found == True + + tdSql.execute("use newdb") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpEscapedDb.py b/tests/army/tools/taosdump/native/taosdumpEscapedDb.py new file mode 100644 index 0000000000..77a17f76f1 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpEscapedDb.py @@ -0,0 +1,124 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database `Db`") + + tdSql.execute("use `Db`") + tdSql.execute( + "create table st(ts timestamp, c1 INT) tags(n1 INT)" + ) + tdSql.execute( + "create table t1 using st tags(1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1)" + ) + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + print("%s Db st -e -o %s -T 1" % (binPath, self.tmpdir)) + os.system("%s Db st -e -o %s -T 1" % (binPath, self.tmpdir)) + # sys.exit(1) + + tdSql.execute("drop database `Db`") + # sys.exit(1) + + os.system("%s -e -i %s -T 1 -W Db=NewDb" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "NewDb": + found = True + break + + assert found == True + + tdSql.execute("use `NewDb`") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("select count(*) from `NewDb`.st") + tdSql.checkData(0, 0, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpInDiffType.py b/tests/army/tools/taosdump/native/taosdumpInDiffType.py new file mode 100644 index 0000000000..5fa15fd7cf --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpInDiffType.py @@ -0,0 +1,120 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3102] taosdump in diff type test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table tb(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into tb values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + # sys.exit(1) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop table tb") + tdSql.execute( + "create table tb(ts timestamp, c1 FLOAT, c2 DOUBLE, c3 BOOL, c4 BINARY(10), c5 NCHAR(10), c6 INT, c7 BOOL, c8 BINARY(10), c9 BOOL, c10 FLOAT, c11 DOUBLE, c12 BOOL, c13 INT, c14 BIGINT)" + ) + # sys.exit(1) + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + + tdSql.query("SELECT * from tb") + for i in range(1, len(tdSql.queryResult[0])): + tdSql.checkData(0, i, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpManyCols.py b/tests/army/tools/taosdump/native/taosdumpManyCols.py new file mode 100644 index 0000000000..d1159f4169 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpManyCols.py @@ -0,0 +1,147 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-1762] taosdump with many columns + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + stb_sql = "create stable stb(ts timestamp" + + # "show create table" only return 64k sql, this over 64k sql need wait engine group fixed + #colCnt = 4095 - 128 # todo + maxCol = 300 + for index in range(maxCol): + stb_sql += ", col%d INT" % (index + 1) + stb_sql += ") tags(tag0 INT" + for index in range(127): + stb_sql += ", tag%d INT" % (index + 1) + stb_sql += ")" + + tdSql.execute(stb_sql) + # sys.exit(1) + + tb_sql = "create table tb using stb tags(0" + for index in range(127): + tb_sql += ",%d" % (index + 1) + tb_sql += ")" + + tdSql.execute(tb_sql) + + # sys.exit(1) + + for record in range(100): + ins_sql = "insert into tb values(%d" % (1640000000000 + record) + for index in range(maxCol): + ins_sql += ",%d" % index + ins_sql += ")" + tdSql.execute(ins_sql) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "stb") + + tdSql.query("show tables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "tb") + + tdSql.query("select count(*) from db.stb") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 100) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpStartEndTime.py b/tests/army/tools/taosdump/native/taosdumpStartEndTime.py new file mode 100644 index 0000000000..26e326f779 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpStartEndTime.py @@ -0,0 +1,145 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-2769] taosdump start-time end-time test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table t1 (ts timestamp, n int)" + ) + tdSql.execute( + "create table t2 (ts timestamp, n int)" + ) + tdSql.execute( + "create table t3 (ts timestamp, n int)" + ) + tdSql.execute( + "insert into t1 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + tdSql.execute( + "insert into t2 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + tdSql.execute( + "insert into t3 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + + # sys.exit(1) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t1 -o %s -T 1 -S 2023-02-28T12:00:01.997+0800 -E 2023-02-28T12:00:03.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t1") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t1") + tdSql.checkData(0, 0, 3) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t2 -o %s -T 1 -S 2023-02-28T12:00:01.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t2") + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t2") + tdSql.checkData(0, 0, 4) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t3 -o %s -T 1 -E 2023-02-28T12:00:03.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t3") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t3") + tdSql.checkData(0, 0, 4) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py b/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py new file mode 100644 index 0000000000..a5718b1c45 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py @@ -0,0 +1,145 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-2769] taosdump start-time end-time test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table t1 (ts timestamp, n int)" + ) + tdSql.execute( + "create table t2 (ts timestamp, n int)" + ) + tdSql.execute( + "create table t3 (ts timestamp, n int)" + ) + tdSql.execute( + "insert into t1 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + tdSql.execute( + "insert into t2 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + tdSql.execute( + "insert into t3 values('2023-02-28 12:00:00.997',11)('2023-02-28 12:00:01.997',12)('2023-02-28 12:00:02.997',15)('2023-02-28 12:00:03.997',16)('2023-02-28 12:00:04.997',17)" + ) + + # sys.exit(1) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t1 -o %s -T 1 --start-time=2023-02-28T12:00:01.997+0800 --end-time=2023-02-28T12:00:03.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t1") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t1") + tdSql.checkData(0, 0, 3) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t2 -o %s -T 1 --start-time=2023-02-28T12:00:01.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t2") + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t2") + tdSql.checkData(0, 0, 4) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s db t3 -o %s -T 1 --end-time=2023-02-28T12:00:03.997+0800 " % (binPath, self.tmpdir)) + + tdSql.execute("drop table t3") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("select count(*) from db.t3") + tdSql.checkData(0, 0, 4) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTest.py b/tests/army/tools/taosdump/native/taosdumpTest.py new file mode 100644 index 0000000000..a1ee9f6a64 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTest.py @@ -0,0 +1,211 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1538548685000 + self.numberOfTables = 10000 + self.numberOfRecords = 100 + + def checkCommunity(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if "community" in selfPath: + return False + else: + return True + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + if not os.path.exists("./taosdumptest/tmp1"): + os.makedirs("./taosdumptest/tmp1") + else: + os.system("rm -rf ./taosdumptest/tmp1") + os.makedirs("./taosdumptest/tmp1") + + if not os.path.exists("./taosdumptest/tmp2"): + os.makedirs("./taosdumptest/tmp2") + else: + os.system("rm -rf ./taosdumptest/tmp2") + os.makedirs("./taosdumptest/tmp2") + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db duration 11 keep 3649") + tdSql.execute("create database db1 duration 12 keep 3640") + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))" + ) + tdSql.execute("create table t1 using st tags(1, 'beijing')") + sql = "insert into t1 values" + currts = self.ts + for i in range(100): + sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) + tdSql.execute(sql) + tdSql.execute("create table t2 using st tags(2, 'shanghai')") + sql = "insert into t2 values" + currts = self.ts + for i in range(100): + sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) + tdSql.execute(sql) + + binPath = self.getPath("taosdump") + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + os.system("%s --databases db -o ./taosdumptest/tmp1" % binPath) + os.system("%s --databases db1 -o ./taosdumptest/tmp2" % binPath) + + tdSql.execute("drop database db") + tdSql.execute("drop database db1") + tdSql.query("select * from information_schema.ins_databases") + tdSql.checkRows(2) + + os.system("%s -W db=newdb -i ./taosdumptest/tmp1" % binPath) + os.system("%s -W \"db=newdb|db1=newdb1\" -i ./taosdumptest/tmp2" % binPath) + + tdSql.execute("use newdb") + tdSql.query("select * from information_schema.ins_databases") + tdSql.checkRows(4) + dbresult = tdSql.queryResult + # 6--duration,7--keep0,keep1,keep + + isCommunity = self.checkCommunity() + print("iscommunity: %d" % isCommunity) + for i in range(len(dbresult)): + if dbresult[i][0] == "newdb": + print(dbresult[i]) + print(type(dbresult[i][6])) + print(type(dbresult[i][7])) + print((dbresult[i][6])) + assert dbresult[i][6] == "11d" + assert dbresult[i][7] == "3649d,3649d,3649d" + if dbresult[i][0] == "newdb1": + print((dbresult[i][6])) + assert dbresult[i][6] == "12d" + print((dbresult[i][7])) + assert dbresult[i][7] == "3640d,3640d,3640d" + + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(2) + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert (dbresult[i][0] == "t1") or (dbresult[i][0] == "t2") + + tdSql.query("select * from t1") + tdSql.checkRows(100) + for i in range(100): + tdSql.checkData(i, 1, i) + tdSql.checkData(i, 2, "nchar%d" % i) + + tdSql.query("select * from t2") + tdSql.checkRows(100) + for i in range(100): + tdSql.checkData(i, 1, i) + tdSql.checkData(i, 2, "nchar%d" % i) + + # drop all databases,boundary value testing. + # length(databasename)<=32;length(tablesname)<=192 + tdSql.execute("drop database newdb") + tdSql.execute("drop database newdb1") + os.system("rm -rf ./taosdumptest/tmp1") + os.system("rm -rf ./taosdumptest/tmp2") + os.makedirs("./taosdumptest/tmp1") + tdSql.execute("create database db12312313231231321312312312_323") + tdSql.error( + "create database db012345678911234567892234567893323456789423456789523456789bcdefe" + ) + tdSql.execute("use db12312313231231321312312312_323") + tdSql.execute( + "create stable st12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))" + ) + tdSql.error( + "create stable st_12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))" + ) + tdSql.execute( + "create stable st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))" + ) + tdSql.error( + "create stable st1(ts timestamp, c1 int, col2_012345678901234567890123456789012345678901234567890123456789 nchar(10)) tags(t1 int, t2 binary(10))" + ) + + tdSql.execute( + "select * from db12312313231231321312312312_323.st12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9" + ) + tdSql.error( + "create table t0_12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9 using st tags(1, 'beijing')" + ) + tdSql.query("show stables") + tdSql.checkRows(2) + os.system( + "%s --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" + % binPath + ) + tdSql.execute("drop database db12312313231231321312312312_323") + os.system("%s -W db12312313231231321312312312_323=db12312313231231321312312312_323abc -i ./taosdumptest/tmp1" % binPath) + tdSql.execute("use db12312313231231321312312312_323abc") + tdSql.query("show stables") + tdSql.checkRows(2) + os.system("rm -rf ./taosdumptest/tmp1") + os.system("rm -rf ./taosdumptest/tmp2") + os.system("rm -rf ./dump_result.txt") + os.system("rm -rf ./db.csv") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTest2.py b/tests/army/tools/taosdump/native/taosdumpTest2.py new file mode 100644 index 0000000000..9618ac4169 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTest2.py @@ -0,0 +1,163 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +from logging.config import dictConfig +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * +import string +import random + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1601481600000 + self.numberOfTables = 1 + self.numberOfRecords = 150 + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def generateString(self, length): + chars = string.ascii_uppercase + string.ascii_lowercase + v = "" + for i in range(length): + v += random.choice(chars) + return v + + def run(self): + if not os.path.exists("./taosdumptest/tmp"): + os.makedirs("./taosdumptest/tmp") + else: + print("directory exists") + os.system("rm -rf ./taosdumptest/tmp/*") + + tdSql.prepare() + + tdSql.execute( + "create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)" + ) + tdSql.execute("create table t1 using st tags(0)") + currts = self.ts + finish = 0 + while finish < self.numberOfRecords: + sql = "insert into t1 values" + for i in range(finish, self.numberOfRecords): + sql += ( + "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" + % (currts + i) + ) + finish = i + 1 + if (1048576 - len(sql)) < 65519: + break + tdSql.execute(sql) + + binPath = self.getPath("taosdump") + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + os.system("rm ./taosdumptest/tmp/*.sql") + os.system("rm ./taosdumptest/tmp/*.avro*") + os.system("rm -rf ./taosdumptest/taosdump.*") + os.system("%s --databases db -o ./taosdumptest/tmp " % binPath) + + tdSql.execute("drop database db") + tdSql.query("show databases") + tdSql.checkRows(2) + + os.system("%s -i ./taosdumptest/tmp " % binPath) + + tdSql.query("show databases") + tdSql.checkRows(3) + tdSql.checkData(2, 0, "db") + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("select count(*) from t1") + tdSql.checkData(0, 0, self.numberOfRecords) + + # test case for TS-1225 + tdSql.execute("create database test") + tdSql.execute("use test") + tdSql.execute( + "create table stb(ts timestamp, c1 binary(16374), c2 binary(16374), c3 binary(16374)) tags(t1 nchar(256))" + ) + tdSql.execute( + "insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')" + % ( + self.generateString(16374), + self.generateString(16374), + self.generateString(16374), + ) + ) + + os.system("rm ./taosdumptest/tmp/*.sql") + os.system("rm ./taosdumptest/tmp/*.avro*") + os.system("rm -rf ./taosdumptest/tmp/taosdump.*") + os.system("%s -D test -o ./taosdumptest/tmp " % binPath) + + tdSql.execute("drop database test") + tdSql.query("show databases") + tdSql.checkRows(3) + + os.system("%s -i ./taosdumptest/tmp " % binPath) + + tdSql.execute("use test") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "stb") + + tdSql.query("select * from stb") + tdSql.checkRows(1) + os.system("rm -rf dump_result.txt") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestBasic.py b/tests/army/tools/taosdump/native/taosdumpTestBasic.py new file mode 100644 index 0000000000..13bc405675 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestBasic.py @@ -0,0 +1,138 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-18291] taosdump basic test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -D db -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestInspect.py b/tests/army/tools/taosdump/native/taosdumpTestInspect.py new file mode 100644 index 0000000000..0d45b45fff --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestInspect.py @@ -0,0 +1,170 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-14544] taosdump data inspect + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + tdSql.execute( + "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + + taosdumpInspectCmd = "%s -I %s/taosdump.*/*.avro* -s | grep 'Schema:'|wc -l" % ( + binPath, + self.tmpdir, + ) + schemaTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode( + "utf-8" + ) + print("schema found times: %d" % int(schemaTimes)) + + if int(schemaTimes) != 1: + caller = inspect.getframeinfo(inspect.stack()[0][0]) + tdLog.exit( + "%s(%d) failed: expected schema found times 1, actual %d" + % (caller.filename, caller.lineno, int(schemaTimes)) + ) + + taosdumpInspectCmd = ( + "%s -I %s/taosdump*/data*/*.avro* -s | grep 'Schema:'|wc -l" + % (binPath, self.tmpdir) + ) + schemaTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode( + "utf-8" + ) + print("schema found times: %d" % int(schemaTimes)) + + if int(schemaTimes) != 2: + caller = inspect.getframeinfo(inspect.stack()[0][0]) + tdLog.exit( + "%s(%d) failed: expected schema found times 2, actual %d" + % (caller.filename, caller.lineno, int(schemaTimes)) + ) + + taosdumpInspectCmd = ( + "%s -I %s/taosdump*/*.avro* | grep '=== Records:'|wc -l" + % (binPath, self.tmpdir) + ) + recordsTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode( + "utf-8" + ) + print("records found times: %d" % int(recordsTimes)) + + if int(recordsTimes) != 1: + caller = inspect.getframeinfo(inspect.stack()[0][0]) + tdLog.exit( + "%s(%d) failed: expected records found times 1, actual %d" + % (caller.filename, caller.lineno, int(recordsTimes)) + ) + + taosdumpInspectCmd = ( + "%s -I %s/taosdump*/data*/*.avro* | grep '=== Records:'|wc -l" + % (binPath, self.tmpdir) + ) + recordsTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode( + "utf-8" + ) + print("records found times: %d" % int(recordsTimes)) + + if int(recordsTimes) != 2: + caller = inspect.getframeinfo(inspect.stack()[0][0]) + tdLog.exit( + "%s(%d) failed: expected records found times 2, actual %d" + % (caller.filename, caller.lineno, int(recordsTimes)) + ) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py b/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py new file mode 100644 index 0000000000..3703ab79db --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py @@ -0,0 +1,128 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-19436] taosdump loose mode test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 INT) tags(n1 INT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + tdSql.execute("create table t2 using st tags(NULL)") + tdSql.execute("insert into t2 values(1640000000000, NULL)") + tdSql.execute( + "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)" + ) + tdSql.execute( + "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)" + ) + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -L -D db -o %s -T 1" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + # sys.exit(1) + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py b/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py new file mode 100644 index 0000000000..f76d2d776f --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py @@ -0,0 +1,322 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + self.ts = 1625068800000000000 # this is timestamp "2021-07-01 00:00:00" + self.numberOfTables = 10 + self.numberOfRecords = 100 + + def checkCommunity(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if "community" in selfPath: + return False + else: + return True + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def createdb(self, precision="ns"): + tb_nums = self.numberOfTables + per_tb_rows = self.numberOfRecords + + def build_db(precision, start_time): + tdSql.execute("drop database if exists timedb1") + tdSql.execute( + "create database timedb1 duration 10 keep 36500 precision " + + '"' + + precision + + '"' + ) + + tdSql.execute("use timedb1") + tdSql.execute( + "create stable st(ts timestamp, c1 int, c2 nchar(10),c3 timestamp) tags(t1 int, t2 binary(10))" + ) + for tb in range(tb_nums): + tbname = "t" + str(tb) + tdSql.execute("create table " + tbname + " using st tags(1, 'beijing')") + sql = "insert into " + tbname + " values" + currts = start_time + if precision == "ns": + ts_seed = 1000000000 + elif precision == "us": + ts_seed = 1000000 + else: + ts_seed = 1000 + + for i in range(per_tb_rows): + sql += "(%d, %d, 'nchar%d',%d)" % ( + currts + i * ts_seed, + i % 100, + i % 100, + currts + i * 100, + ) # currts +1000ms (1000000000ns) + tdSql.execute(sql) + + if precision == "ns": + start_time = 1625068800000000000 + build_db(precision, start_time) + + elif precision == "us": + start_time = 1625068800000000 + build_db(precision, start_time) + + elif precision == "ms": + start_time = 1625068800000 + build_db(precision, start_time) + + else: + print("other time precision not valid , please check! ") + + def run(self): + + # clear envs + os.system("rm -rf ./taosdumptest/") + tdSql.execute("drop database if exists dumptmp1") + tdSql.execute("drop database if exists dumptmp2") + tdSql.execute("drop database if exists dumptmp3") + + if not os.path.exists("./taosdumptest/tmp1"): + os.makedirs("./taosdumptest/dumptmp1") + else: + print("path exist!") + + if not os.path.exists("./taosdumptest/dumptmp2"): + os.makedirs("./taosdumptest/dumptmp2") + + if not os.path.exists("./taosdumptest/dumptmp3"): + os.makedirs("./taosdumptest/dumptmp3") + + binPath = self.getPath("taosdump") + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + # create nano second database + + self.createdb(precision="ns") + + # dump all data + + os.system("%s -g --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath) + + # dump part data with -S -E + os.system( + "%s -g --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 " + % binPath + ) + os.system( + "%s -g --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 " + % binPath + ) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp2" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 510) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp3" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 900) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 1000) + + # check data + origin_res = tdSql.getResult("select * from timedb1.st") + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + dump_res = tdSql.getResult("select * from timedb1.st") + if origin_res == dump_res: + tdLog.info("test nano second : dump check data pass for all data!") + else: + tdLog.info("test nano second : dump check data failed for all data!") + + # us second support test case + + os.system("rm -rf ./taosdumptest/") + tdSql.execute("drop database if exists timedb1") + + if not os.path.exists("./taosdumptest/tmp1"): + os.makedirs("./taosdumptest/dumptmp1") + else: + print("path exits!") + + if not os.path.exists("./taosdumptest/dumptmp2"): + os.makedirs("./taosdumptest/dumptmp2") + + if not os.path.exists("./taosdumptest/dumptmp3"): + os.makedirs("./taosdumptest/dumptmp3") + + self.createdb(precision="us") + + os.system("%s -g --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath) + + os.system( + "%s -g --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 " + % binPath + ) + os.system( + "%s -g --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 " + % binPath + ) + + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + os.system("%s -i ./taosdumptest/dumptmp2" % binPath) + os.system("%s -i ./taosdumptest/dumptmp3" % binPath) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp2" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 510) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp3" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 900) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 1000) + + # check data + origin_res = tdSql.getResult("select * from timedb1.st") + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + dump_res = tdSql.getResult("select * from timedb1.st") + if origin_res == dump_res: + tdLog.info("test micro second : dump check data pass for all data!") + else: + tdLog.info("test micro second : dump check data failed for all data!") + + # ms second support test case + + os.system("rm -rf ./taosdumptest/") + tdSql.execute("drop database if exists timedb1") + + if not os.path.exists("./taosdumptest/tmp1"): + os.makedirs("./taosdumptest/dumptmp1") + else: + print("path exits!") + + if not os.path.exists("./taosdumptest/dumptmp2"): + os.makedirs("./taosdumptest/dumptmp2") + + if not os.path.exists("./taosdumptest/dumptmp3"): + os.makedirs("./taosdumptest/dumptmp3") + + self.createdb(precision="ms") + + os.system("%s -g --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath) + + os.system( + "%s -g --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 " + % binPath + ) + os.system( + "%s -g --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 " + % binPath + ) + + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + os.system("%s -i ./taosdumptest/dumptmp2" % binPath) + os.system("%s -i ./taosdumptest/dumptmp3" % binPath) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp2" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 510) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp3" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 900) + + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + tdSql.query("select count(*) from timedb1.st") + tdSql.checkData(0, 0, 1000) + + # check data + origin_res = tdSql.getResult("select * from timedb1.st") + tdSql.execute("drop database timedb1") + os.system("%s -i ./taosdumptest/dumptmp1" % binPath) + # dump data and check for taosdump + dump_res = tdSql.getResult("select * from timedb1.st") + if origin_res == dump_res: + tdLog.info("test million second : dump check data pass for all data!") + else: + tdLog.info("test million second : dump check data failed for all data!") + + os.system("rm -rf ./taosdumptest/") + os.system("rm -rf ./dump_result.txt") + os.system("rm -rf *.py.sql") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py new file mode 100644 index 0000000000..f0b2a45ad1 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py @@ -0,0 +1,150 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports big int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 BIGINT) tags(bntag BIGINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(9223372036854775807)") + tdSql.execute("insert into t2 values(1640000000000, 9223372036854775807)") + + tdSql.execute("create table t3 using st tags(-9223372036854775807)") + tdSql.execute("insert into t3 values(1640000000000, -9223372036854775807)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where bntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where bntag = 9223372036854775807") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 9223372036854775807) + tdSql.checkData(0, 2, 9223372036854775807) + + tdSql.query("select * from st where bntag = -9223372036854775807") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -9223372036854775807) + tdSql.checkData(0, 2, -9223372036854775807) + + tdSql.query("select * from st where bntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py new file mode 100644 index 0000000000..3e6933d5d5 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py @@ -0,0 +1,144 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports binary + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 BINARY(5), c2 BINARY(5)) tags(btag BINARY(5))" + ) + tdSql.execute("create table t1 using st tags('test')") + tdSql.execute("insert into t1 values(1640000000000, '01234', '56789')") + tdSql.execute("insert into t1 values(1640000000001, 'abcd', 'efgh')") + tdSql.execute("create table t2 using st tags(NULL)") + tdSql.execute("insert into t2 values(1640000000000, NULL, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(2) + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert dbresult[i][0] in ("t1", "t2") + + tdSql.query("select distinct(btag) from st where tbname = 't1'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "test") + + tdSql.query("select distinct(btag) from st where tbname = 't2'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select * from st where btag = 'test'") + tdSql.checkRows(2) + tdSql.checkData(0, 1, "01234") + tdSql.checkData(0, 2, "56789") + tdSql.checkData(1, 1, "abcd") + tdSql.checkData(1, 2, "efgh") + + tdSql.query("select * from st where btag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py new file mode 100644 index 0000000000..ab2f5e8985 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py @@ -0,0 +1,147 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports bool + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 BOOL) tags(btag BOOL)") + tdSql.execute("create table t1 using st tags(true)") + tdSql.execute("insert into t1 values(1640000000000, true)") + tdSql.execute("create table t2 using st tags(false)") + tdSql.execute("insert into t2 values(1640000000000, false)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert ( + (dbresult[i][0] == "t1") + or (dbresult[i][0] == "t2") + or (dbresult[i][0] == "t3") + ) + + tdSql.query("select btag from st") + tdSql.checkRows(3) + dbresult = tdSql.queryResult + print(dbresult) + + tdSql.query("select * from st where btag = true") + tdSql.checkRows(1) + tdSql.checkData(0, 1, "True") + tdSql.checkData(0, 2, "True") + + tdSql.query("select * from st where btag = false") + tdSql.checkRows(1) + tdSql.checkData(0, 1, "False") + tdSql.checkData(0, 2, "False") + + tdSql.query("select * from st where btag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py b/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py new file mode 100644 index 0000000000..bf370c7fa2 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py @@ -0,0 +1,171 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import math +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports double + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 DOUBLE) tags(dbtag DOUBLE)") + tdSql.execute("create table t1 using st tags(1.0)") + tdSql.execute("insert into t1 values(1640000000000, 1.0)") + + tdSql.execute("create table t2 using st tags(1.7E308)") + tdSql.execute("insert into t2 values(1640000000000, 1.7E308)") + + tdSql.execute("create table t3 using st tags(-1.7E308)") + tdSql.execute("insert into t3 values(1640000000000, -1.7E308)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where dbtag = 1.0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.0)) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 1.0)) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag = 1.7E308") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.7e308) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 1.7e308) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag = -1.7E308") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), -1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), -1.7e308) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), -1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), -1.7e308) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py b/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py new file mode 100644 index 0000000000..77e1e02383 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py @@ -0,0 +1,170 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import math +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports float + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 FLOAT) tags(ftag FLOAT)") + tdSql.execute("create table t1 using st tags(1.0)") + tdSql.execute("insert into t1 values(1640000000000, 1.0)") + + tdSql.execute("create table t2 using st tags(3.40E+38)") + tdSql.execute("insert into t2 values(1640000000000, 3.40E+38)") + + tdSql.execute("create table t3 using st tags(-3.40E+38)") + tdSql.execute("insert into t3 values(1640000000000, -3.40E+38)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where ftag = 1.0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.0)) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.0): + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag = 3.4E38") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 3.4e38, rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 3.4e38) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 3.4e38, rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 3.4e38) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag = -3.4E38") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), (-3.4e38), rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), -3.4e38) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), (-3.4e38), rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), -3.4e38) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py new file mode 100644 index 0000000000..092c8ee73b --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py @@ -0,0 +1,147 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 INT) tags(ntag INT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + tdSql.execute("create table t2 using st tags(2147483647)") + tdSql.execute("insert into t2 values(1640000000000, 2147483647)") + tdSql.execute("create table t3 using st tags(-2147483647)") + tdSql.execute("insert into t3 values(1640000000000, -2147483647)") + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where ntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where ntag = 2147483647") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 2147483647) + tdSql.checkData(0, 2, 2147483647) + + tdSql.query("select * from st where ntag = -2147483647") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -2147483647) + tdSql.checkData(0, 2, -2147483647) + + tdSql.query("select * from st where ntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py b/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py new file mode 100644 index 0000000000..dca1188168 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py @@ -0,0 +1,162 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12362] taosdump supports JSON + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 int) tags(jtag JSON)") + tdSql.execute('create table t1 using st tags(\'{"location": "beijing"}\')') + tdSql.execute("insert into t1 values(1500000000000, 1)") + + tdSql.execute("create table t2 using st tags(NULL)") + tdSql.execute("insert into t2 values(1500000000000, NULL)") + + tdSql.execute("create table t3 using st tags('')") + tdSql.execute("insert into t3 values(1500000000000, 0)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -g" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + + os.system("%s -i %s -g" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert ( + (dbresult[i][0] == "t1") + or (dbresult[i][0] == "t2") + or (dbresult[i][0] == "t3") + ) + + tdSql.query("select jtag->'location' from st") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + found = False + for i in range(len(dbresult)): + if dbresult[i][0] == '"beijing"': + found = True + break + + assert found == True + + tdSql.query("select * from st where jtag contains 'location'") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, '{"location":"beijing"}') + + tdSql.query("select jtag from st") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + found = False + for i in range(len(dbresult)): + if dbresult[i][0] == '{"location":"beijing"}': + found = True + break + + assert found == True + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py new file mode 100644 index 0000000000..f3fcdaab1a --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py @@ -0,0 +1,148 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports small int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 SMALLINT) tags(sntag SMALLINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(32767)") + tdSql.execute("insert into t2 values(1640000000000, 32767)") + + tdSql.execute("create table t3 using st tags(-32767)") + tdSql.execute("insert into t3 values(1640000000000, -32767)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where sntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where sntag = 32767") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 32767) + tdSql.checkData(0, 2, 32767) + + tdSql.query("select * from st where sntag = -32767") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -32767) + tdSql.checkData(0, 2, -32767) + + tdSql.query("select * from st where sntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py new file mode 100644 index 0000000000..88c3929fe2 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py @@ -0,0 +1,150 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports tiny int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 TINYINT) tags(tntag TINYINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(127)") + tdSql.execute("insert into t2 values(1640000000000, 127)") + + tdSql.execute("create table t3 using st tags(-127)") + tdSql.execute("insert into t3 values(1640000000000, -127)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where tntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where tntag = 127") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 127) + tdSql.checkData(0, 2, 127) + + tdSql.query("select * from st where tntag = -127") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -127) + tdSql.checkData(0, 2, -127) + + tdSql.query("select * from st where tntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py new file mode 100644 index 0000000000..b5c9c01ce7 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py @@ -0,0 +1,141 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12655] taosdump supports unsigned big int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 BIGINT UNSIGNED) tags(ubntag BIGINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(18446744073709551614)") + tdSql.execute("insert into t2 values(1640000000000, 18446744073709551614)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1 -g" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1 -g" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where ubntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where ubntag = 18446744073709551614") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 18446744073709551614) + tdSql.checkData(0, 2, 18446744073709551614) + + tdSql.query("select * from st where ubntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py new file mode 100644 index 0000000000..26ad2069eb --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py @@ -0,0 +1,141 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT UNSIGNED) tags(untag INT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(4294967294)") + tdSql.execute("insert into t2 values(1640000000000, 4294967294)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1 -g" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1 -g" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where untag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where untag = 4294967294") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 4294967294) + tdSql.checkData(0, 2, 4294967294) + + tdSql.query("select * from st where untag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py new file mode 100644 index 0000000000..11b8db7451 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py @@ -0,0 +1,141 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned small int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 SMALLINT UNSIGNED) tags(usntag SMALLINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(65534)") + tdSql.execute("insert into t2 values(1640000000000, 65534)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1 -g" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1 -g" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where usntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where usntag = 65534") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 65534) + tdSql.checkData(0, 2, 65534) + + tdSql.query("select * from st where usntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py new file mode 100644 index 0000000000..c0d3d28b1c --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py @@ -0,0 +1,141 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned tiny int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 TINYINT UNSIGNED) tags(utntag TINYINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(254)") + tdSql.execute("insert into t2 values(1640000000000, 254)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s --databases db -o %s -T 1 -g" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -i %s -T 1 -g" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where utntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where utntag = 254") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 254) + tdSql.checkData(0, 2, 254) + + tdSql.query("select * from st where utntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py b/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py new file mode 100644 index 0000000000..6610339ba9 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py @@ -0,0 +1,244 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import json +import copy +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def exec(self, command): + tdLog.info(command) + return os.system(command) + + def findPrograme(self): + # taosdump + taosdump = self.getPath("taosdump") + if taosdump == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % taosdump) + + # taosBenchmark + benchmark = self.getPath("taosBenchmark") + if benchmark == "": + tdLog.exit("benchmark not found!") + else: + tdLog.info("benchmark found in %s" % benchmark) + + # tmp dir + tmpdir = "./tmp" + if not os.path.exists(tmpdir): + os.makedirs(tmpdir) + else: + print("directory exists") + os.system("rm -rf %s/*" % tmpdir) + + return taosdump, benchmark,tmpdir + + def checkCorrectWithJson(self, jsonFile, newdb = None, checkInterval=False): + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + # db come from arguments + if newdb is None: + db = data["databases"][0]["dbinfo"]["name"] + else: + db = newdb + + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + tdLog.info(f"get json: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + if checkInterval: + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + def testBenchmarkJson(self, benchmark, jsonFile, options="", checkInterval=False): + # exe insert + cmd = f"{benchmark} {options} -f {jsonFile}" + self.exec(cmd) + self.checkCorrectWithJson(jsonFile) + + def insertData(self, benchmark, json, db): + # insert super table + self.testBenchmarkJson(benchmark, json) + + + # normal table + sqls = [ + f"create table {db}.ntb(st timestamp, c1 int, c2 geometry(128))", + f"insert into {db}.ntb values(now, 0, NULL)", + f"insert into {db}.ntb values(now, 1, 'POINT(2 5)')", + f"insert into {db}.ntb values(now, 2, 'LINESTRING(2 5, 4 7)')", + f"insert into {db}.ntb values(now, 3, 'LINESTRING(2 6, 4 8, 9 3)')", + f"insert into {db}.ntb values(now, 4, 'LINESTRING(2 5, 4 9)')", + f"insert into {db}.ntb values(now, 5, 'LINESTRING(2 9, 3 14,6 19)')" + ] + for sql in sqls: + tdSql.execute(sql) + + def dumpOut(self, taosdump, db , outdir): + # dump out + self.exec(f"{taosdump} -D {db} -o {outdir}") + + def dumpIn(self, taosdump, db, newdb, indir): + # dump in + self.exec(f'{taosdump} -W "{db}={newdb}" -i {indir}') + + def checkAggSame(self, db, newdb, stb, aggfun): + # sum pk db + sql = f"select {aggfun} from {db}.{stb}" + tdSql.query(sql) + sum1 = tdSql.getData(0,0) + # sum pk newdb + sql = f"select {aggfun} from {newdb}.{stb}" + tdSql.query(sql) + sum2 = tdSql.getData(0,0) + + if sum1 == sum2: + tdLog.info(f"{aggfun} source db:{sum1} import db:{sum2} both equal.") + else: + tdLog.exit(f"{aggfun} source db:{sum1} import db:{sum2} not equal.") + + def checkProjSame(self, db, newdb, stb , row, col, where = "where tbname='d0'"): + # sum pk db + sql = f"select * from {db}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val1 = copy.deepcopy(tdSql.getData(row, col)) + # sum pk newdb + sql = f"select * from {newdb}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val2 = copy.deepcopy(tdSql.getData(row, col)) + + if val1 == val2: + tdLog.info(f"{db}.{stb} {row},{col} source db:{val1} import db:{val2} both equal.") + else: + tdLog.exit(f"{db}.{stb} {row},{col} source db:{val1} len={len(val1)} import db:{val2} len={len(val2)} not equal.") + + + def verifyResult(self, db, newdb, json): + # compare with insert json + self.checkCorrectWithJson(json, newdb) + + # compare sum(pk) + stb = "meters" + self.checkAggSame(db, newdb, stb, "sum(ic)") + self.checkAggSame(db, newdb, stb, "sum(usi)") + self.checkProjSame(db, newdb, stb, 0, 3) + self.checkProjSame(db, newdb, stb, 0, 4) + self.checkProjSame(db, newdb, stb, 0, 6) # tag + + self.checkProjSame(db, newdb, stb, 8, 3) + self.checkProjSame(db, newdb, stb, 8, 4) + self.checkProjSame(db, newdb, stb, 8, 6) # tag + + + # check normal table + self.checkAggSame(db, newdb, "ntb", "sum(c1)") + # 0 line + self.checkProjSame(db, newdb, "ntb", 0, 0, "") + self.checkProjSame(db, newdb, "ntb", 0, 1, "") + self.checkProjSame(db, newdb, "ntb", 0, 2, "") + # 3 line + self.checkProjSame(db, newdb, "ntb", 3, 0, "") + self.checkProjSame(db, newdb, "ntb", 3, 1, "") + self.checkProjSame(db, newdb, "ntb", 3, 2, "") + + + def run(self): + + # TD-33002 BLOCK this case , if fixed this bug, please open this case + return + + # database + db = "geodb" + newdb = "ngeodb" + + # find + taosdump, benchmark, tmpdir = self.findPrograme() + json = "./taosdump/native/json/geometry.json" + + # insert data with taosBenchmark + self.insertData(benchmark, json, db) + + # dump out + self.dumpOut(taosdump, db, tmpdir) + + # dump in + self.dumpIn(taosdump, db, newdb, tmpdir) + + # verify db + self.verifyResult(db, newdb, json) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py b/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py new file mode 100644 index 0000000000..adbed7d877 --- /dev/null +++ b/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py @@ -0,0 +1,247 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import json +import copy +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def exec(self, command): + tdLog.info(command) + return os.system(command) + + def findPrograme(self): + # taosdump + taosdump = self.getPath("taosdump") + if taosdump == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % taosdump) + + # taosBenchmark + benchmark = self.getPath("taosBenchmark") + if benchmark == "": + tdLog.exit("benchmark not found!") + else: + tdLog.info("benchmark found in %s" % benchmark) + + # tmp dir + tmpdir = "./tmp" + if not os.path.exists(tmpdir): + os.makedirs(tmpdir) + else: + print("directory exists") + os.system("rm -rf %s/*" % tmpdir) + + return taosdump, benchmark,tmpdir + + def checkCorrectWithJson(self, jsonFile, newdb = None, checkInterval=False): + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + # db come from arguments + if newdb is None: + db = data["databases"][0]["dbinfo"]["name"] + else: + db = newdb + + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + tdLog.info(f"get json: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + if checkInterval: + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + def testBenchmarkJson(self, benchmark, jsonFile, options="", checkInterval=False): + # exe insert + cmd = f"{benchmark} {options} -f {jsonFile}" + self.exec(cmd) + self.checkCorrectWithJson(jsonFile) + + def insertData(self, benchmark, json, db): + # insert super table + self.testBenchmarkJson(benchmark, json) + + # normal table + sqls = [ + f"create table {db}.ntb(st timestamp, c1 int, c2 varbinary(32))", + f"insert into {db}.ntb values(now, 0, 'abc1')", + f"insert into {db}.ntb values(now, 1, NULL)", + f"insert into {db}.ntb values(now, 2, '\\x616263')", + f"insert into {db}.ntb values(now, 3, 'abc3')", + f"insert into {db}.ntb values(now, 4, 'abc4')", + f"insert into {db}.ntb values(now, 5, 'abc5')", + ] + for sql in sqls: + tdSql.execute(sql) + + def dumpOut(self, taosdump, db , outdir): + # dump out + self.exec(f"{taosdump} -D {db} -o {outdir}") + + def dumpIn(self, taosdump, db, newdb, indir): + # dump in + self.exec(f'{taosdump} -W "{db}={newdb}" -i {indir}') + + def checkAggSame(self, db, newdb, stb, aggfun): + # sum pk db + sql = f"select {aggfun} from {db}.{stb}" + tdSql.query(sql) + sum1 = tdSql.getData(0,0) + # sum pk newdb + sql = f"select {aggfun} from {newdb}.{stb}" + tdSql.query(sql) + sum2 = tdSql.getData(0,0) + + if sum1 == sum2: + tdLog.info(f"{aggfun} source db:{sum1} import db:{sum2} both equal.") + else: + tdLog.exit(f"{aggfun} source db:{sum1} import db:{sum2} not equal.") + + def checkProjSame(self, db, newdb, stb , row, col, where = "where tbname='d0'"): + # sum pk db + sql = f"select * from {db}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val1 = copy.deepcopy(tdSql.getData(row, col)) + # sum pk newdb + sql = f"select * from {newdb}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val2 = copy.deepcopy(tdSql.getData(row, col)) + + if val1 == val2: + tdLog.info(f"{db}.{stb} {row},{col} source db:{val1} import db:{val2} both equal.") + else: + tdLog.exit(f"{db}.{stb} {row},{col} source db:{val1} len={len(val1)} import db:{val2} len={len(val2)} not equal.") + + + def verifyResult(self, db, newdb, json): + # compare with insert json + self.checkCorrectWithJson(json, newdb) + + # compare sum(pk) + stb = "meters" + self.checkAggSame(db, newdb, stb, "sum(ic)") + self.checkAggSame(db, newdb, stb, "sum(usi)") + self.checkProjSame(db, newdb, stb, 0, 3) + self.checkProjSame(db, newdb, stb, 0, 4) + self.checkProjSame(db, newdb, stb, 0, 6) # tag + + self.checkProjSame(db, newdb, stb, 8, 3) + self.checkProjSame(db, newdb, stb, 8, 4) + self.checkProjSame(db, newdb, stb, 8, 6) # tag + + # check normal table + tb = "ntb" + self.checkAggSame(db, newdb, tb, "sum(c1)") + # 0 line + self.checkProjSame(db, newdb, tb, 0, 0, "") + self.checkProjSame(db, newdb, tb, 0, 1, "") + self.checkProjSame(db, newdb, tb, 0, 2, "") + # 1 line + self.checkProjSame(db, newdb, tb, 1, 0, "") + self.checkProjSame(db, newdb, tb, 1, 1, "") + self.checkProjSame(db, newdb, tb, 1, 2, "") + # 3 line + self.checkProjSame(db, newdb, tb, 3, 0, "") + self.checkProjSame(db, newdb, tb, 3, 1, "") + self.checkProjSame(db, newdb, tb, 3, 2, "") + + + def run(self): + + # TD-33002 BLOCK this case , if fixed this bug, please open this case + return + + # database + db = "varbin" + newdb = "nvarbin" + + # find + taosdump, benchmark, tmpdir = self.findPrograme() + json = "./taosdump/native/json/varbinary.json" + + # insert data with taosBenchmark + self.insertData(benchmark, json, db) + + # dump out + self.dumpOut(taosdump, db, tmpdir) + + # dump in + self.dumpIn(taosdump, db, newdb, tmpdir) + + # verify db + self.verifyResult(db, newdb, json) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/json/primaryKey.json b/tests/army/tools/taosdump/ws3/json/primaryKey.json new file mode 100644 index 0000000000..fb35928594 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/json/primaryKey.json @@ -0,0 +1,71 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 1000, + "create_table_thread_count": 2, + "thread_count": 10, + "prepared_rand": 1000, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "pridb", + "drop": "yes", + "vgroups": 2, + "replica": 1, + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 1000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "insert_interval": 0, + "timestamp_step": 10, + "start_timestamp":1600000000000, + "primary_key":1, + "repeat_ts_min": 10, + "repeat_ts_max": 10, + "disorder_ratio":0, + "update_ratio": 0, + "delete_ratio": 0, + "disorder_fill_interval": 100, + "update_fill_interval": 25, + "generate_row_rule": 2, + "columns": [ + { "type": "int", "name": "pk", "max": 100000, "min": 0, "gen":"order","fillNull":"false"}, + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "min": 1, "gen":"order"}, + { "type": "double", "name": "dc", "min":10, "gen":"order"}, + { "type": "tinyint", "name": "ti", "gen":"order"}, + { "type": "smallint", "name": "si", "gen":"order"}, + { "type": "int", "name": "ic", "gen":"order", "fillNull":"false"}, + { "type": "bigint", "name": "bi", "gen":"order"}, + { "type": "utinyint", "name": "uti", "gen":"order"}, + { "type": "usmallint", "name": "usi", "gen":"order"}, + { "type": "uint", "name": "ui", "gen":"order"}, + { "type": "ubigint", "name": "ubi", "gen":"order"}, + { "type": "binary", "name": "bin", "len": 32, "gen":"order"}, + { "type": "nchar", "name": "nch", "len": 64, "gen":"order"} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/taosdump/ws3/json/retry.json b/tests/army/tools/taosdump/ws3/json/retry.json new file mode 100644 index 0000000000..7c9572f24e --- /dev/null +++ b/tests/army/tools/taosdump/ws3/json/retry.json @@ -0,0 +1,61 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "num_of_records_per_req": 5000, + "create_table_thread_count": 1, + "thread_count": 8, + "prepared_rand": 10000, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "redb", + "drop": "yes", + "vgroups": 8, + "replica": 1, + "precision": "ms" + }, + "super_tables": [ + { + "name": "meters", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 100000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 10, + "start_timestamp":1600000000000, + "generate_row_rule": 2, + "columns": [ + { "type": "int", "name": "pk", "max": 100000, "min": 0, "gen":"order","fillNull":"false"}, + { "type": "bool", "name": "bc"}, + { "type": "float", "name": "fc", "min": 1, "gen":"order"}, + { "type": "double", "name": "dc", "min":10, "gen":"order"}, + { "type": "tinyint", "name": "ti"}, + { "type": "smallint", "name": "si"}, + { "type": "int", "name": "ic", "gen":"order", "fillNull":"false"}, + { "type": "bigint", "name": "bi", "gen":"order"}, + { "type": "utinyint", "name": "uti", "gen":"order"}, + { "type": "usmallint", "name": "usi", "gen":"order"}, + { "type": "uint", "name": "ui", "gen":"order"}, + { "type": "ubigint", "name": "ubi", "gen":"order"}, + { "type": "binary", "name": "bin", "len": 32}, + { "type": "nchar", "name": "nch", "len": 64, "gen":"order"} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 10,"min": 1}, + {"type": "binary", "name": "location", "len": 16, + "values": ["San Francisco", "Los Angles", "San Diego", + "San Jose", "Palo Alto", "Campbell", "Mountain View", + "Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py new file mode 100644 index 0000000000..e9d35393da --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py @@ -0,0 +1,124 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database `Db`") + + tdSql.execute("use `Db`") + tdSql.execute( + "create table st(ts timestamp, c1 INT) tags(n1 INT)" + ) + tdSql.execute( + "create table t1 using st tags(1)" + ) + tdSql.execute( + "insert into t1 values(1640000000000, 1)" + ) + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + print("%s Db st -R -e -o %s -T 1" % (binPath, self.tmpdir)) + os.system("%s Db st -R -e -o %s -T 1" % (binPath, self.tmpdir)) + # sys.exit(1) + + tdSql.execute("drop database `Db`") + # sys.exit(1) + + os.system("%s -R -e -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "Db": + found = True + break + + assert found == True + + tdSql.execute("use `Db`") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("select count(*) from `Db`.st") + tdSql.checkData(0, 0, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py b/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py new file mode 100644 index 0000000000..aa67a2f73c --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py @@ -0,0 +1,206 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import json +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def exec(self, command): + tdLog.info(command) + return os.system(command) + + def findPrograme(self): + # taosdump + taosdump = self.getPath("taosdump") + if taosdump == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % taosdump) + + # taosBenchmark + benchmark = self.getPath("taosBenchmark") + if benchmark == "": + tdLog.exit("benchmark not found!") + else: + tdLog.info("benchmark found in %s" % benchmark) + + # tmp dir + tmpdir = "./tmp" + if not os.path.exists(tmpdir): + os.makedirs(tmpdir) + else: + print("directory exists") + os.system("rm -rf %s/*" % tmpdir) + + return taosdump, benchmark,tmpdir + + def checkCorrectWithJson(self, jsonFile, newdb = None, checkInterval=False): + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + # db come from arguments + if newdb is None: + db = data["databases"][0]["dbinfo"]["name"] + else: + db = newdb + + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + tdLog.info(f"get json: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + if checkInterval: + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + def testBenchmarkJson(self, benchmark, jsonFile, options="", checkInterval=False): + # exe insert + cmd = f"{benchmark} {options} -f {jsonFile}" + self.exec(cmd) + self.checkCorrectWithJson(jsonFile) + + def insertData(self, benchmark, json, db): + # insert super table + self.testBenchmarkJson(benchmark, json) + + # normal table + sqls = [ + f"create table {db}.ntb(st timestamp, c1 int, c2 binary(32))", + f"insert into {db}.ntb values(now, 1, 'abc1')", + f"insert into {db}.ntb values(now, 2, 'abc2')", + f"insert into {db}.ntb values(now, 3, 'abc3')", + f"insert into {db}.ntb values(now, 4, 'abc4')", + f"insert into {db}.ntb values(now, 5, 'abc5')", + ] + for sql in sqls: + tdSql.execute(sql) + + def dumpOut(self, taosdump, db , outdir): + # dump out + self.exec(f"{taosdump} -D {db} -o {outdir}") + + def dumpIn(self, taosdump, db, newdb, indir): + # dump in + self.exec(f'{taosdump} -W "{db}={newdb}" -i {indir}') + + def checkSame(self, db, newdb, stb, aggfun): + # sum pk db + sql = f"select {aggfun} from {db}.{stb}" + tdSql.query(sql) + sum1 = tdSql.getData(0,0) + # sum pk newdb + sql = f"select {aggfun} from {newdb}.{stb}" + tdSql.query(sql) + sum2 = tdSql.getData(0,0) + + if sum1 == sum2: + tdLog.info(f"{aggfun} source db:{sum1} import db:{sum2} both equal.") + else: + tdLog.exit(f"{aggfun} source db:{sum1} import db:{sum2} not equal.") + + + def verifyResult(self, db, newdb, json): + # compare with insert json + self.checkCorrectWithJson(json, newdb) + + # compare sum(pk) + stb = "meters" + self.checkSame(db, newdb, stb, "sum(pk)") + self.checkSame(db, newdb, stb, "sum(usi)") + self.checkSame(db, newdb, stb, "sum(ic)") + + # check normal table + self.checkSame(db, newdb, "ntb", "sum(c1)") + + def run(self): + # database + db = "pridb" + newdb = "npridb" + + # find + taosdump, benchmark, tmpdir = self.findPrograme() + json = "./taosdump/ws3/json/primaryKey.json" + + # insert data with taosBenchmark + self.insertData(benchmark, json, db) + + # dump out + self.dumpOut(taosdump, db, tmpdir) + + # dump in + self.dumpIn(taosdump, db, newdb, tmpdir) + + # verify db + self.verifyResult(db, newdb, json) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpRetry.py b/tests/army/tools/taosdump/ws3/taosdumpRetry.py new file mode 100644 index 0000000000..f66b0a7890 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpRetry.py @@ -0,0 +1,264 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import json +import copy +import time +from threading import Thread +from threading import Event + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + +# +# kill taosadapter task +# +def killTask(stopEvent, taosadapter, presleep, sleep, count): + tdLog.info(f"kill task pre sleep {presleep}s\n") + time.sleep(presleep) + stopcmd = "kill -9 $(pidof taosadapter)" + startcmd = f"nohup {taosadapter} --logLevel=error --opentsdb_telnet.enable=true > ~/taosa.log 2>&1 &" + for i in range(count): + tdLog.info(f" i={i} cmd:{stopcmd} sleep {sleep}s\n") + os.system(stopcmd) + time.sleep(sleep) + tdLog.info(f" start cmd:{startcmd}\n") + os.system(startcmd) + if stopEvent.is_set(): + tdLog.info(" recv stop event and exit killTask ...\n") + break + + tdLog.info("kill task exited.\n") + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TS-3072] taosdump dump escaped db name test + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def exec(self, command): + tdLog.info(command) + return os.system(command) + + def findPrograme(self): + # taosdump + taosdump = self.getPath("taosdump") + if taosdump == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % taosdump) + + # taosBenchmark + benchmark = self.getPath("taosBenchmark") + if benchmark == "": + tdLog.exit("benchmark not found!") + else: + tdLog.info("benchmark found in %s" % benchmark) + + # taosadapter + taosadapter = self.getPath("taosadapter") + if taosadapter == "": + tdLog.exit("taosadapter not found!") + else: + tdLog.info("taosadapter found in %s" % taosadapter) + + # tmp dir + tmpdir = "./tmp" + if not os.path.exists(tmpdir): + os.makedirs(tmpdir) + else: + print(f"{tmpdir} directory exists, clear data.") + os.system("rm -rf %s/*" % tmpdir) + + return taosdump, benchmark, taosadapter, tmpdir + + def checkCorrectWithJson(self, jsonFile, newdb = None, checkInterval=False): + # + # check insert result + # + with open(jsonFile, "r") as file: + data = json.load(file) + + # db come from arguments + if newdb is None: + db = data["databases"][0]["dbinfo"]["name"] + else: + db = newdb + + stb = data["databases"][0]["super_tables"][0]["name"] + child_count = data["databases"][0]["super_tables"][0]["childtable_count"] + insert_rows = data["databases"][0]["super_tables"][0]["insert_rows"] + timestamp_step = data["databases"][0]["super_tables"][0]["timestamp_step"] + + tdLog.info(f"get json: db={db} stb={stb} child_count={child_count} insert_rows={insert_rows} \n") + + # all count insert_rows * child_table_count + sql = f"select * from {db}.{stb}" + tdSql.query(sql) + tdSql.checkRows(child_count * insert_rows) + + # timestamp step + if checkInterval: + sql = f"select * from (select diff(ts) as dif from {db}.{stb} partition by tbname) where dif != {timestamp_step};" + tdSql.query(sql) + tdSql.checkRows(0) + + def testBenchmarkJson(self, benchmark, jsonFile, options="", checkInterval=False): + # exe insert + cmd = f"{benchmark} {options} -f {jsonFile}" + self.exec(cmd) + + def insertData(self, benchmark, json, db): + # insert super table + self.testBenchmarkJson(benchmark, json) + + + def dumpOut(self, taosdump, db , outdir): + # dump out + self.exec(f"{taosdump} -T 2 -k 2 -z 800 -D {db} -o {outdir}") + + def dumpIn(self, taosdump, db, newdb, indir): + # dump in + self.exec(f'{taosdump} -T 10 -W "{db}={newdb}" -i {indir}') + + def checkAggSame(self, db, newdb, stb, aggfun): + # sum pk db + sql = f"select {aggfun} from {db}.{stb}" + tdSql.query(sql) + sum1 = tdSql.getData(0,0) + # sum pk newdb + sql = f"select {aggfun} from {newdb}.{stb}" + tdSql.query(sql) + sum2 = tdSql.getData(0,0) + + if sum1 == sum2: + tdLog.info(f"{aggfun} source db:{sum1} import db:{sum2} both equal.") + else: + tdLog.exit(f"{aggfun} source db:{sum1} import db:{sum2} not equal.") + + def checkProjSame(self, db, newdb, stb , row, col, where = "where tbname='d0'"): + # sum pk db + sql = f"select * from {db}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val1 = copy.deepcopy(tdSql.getData(row, col)) + # sum pk newdb + sql = f"select * from {newdb}.{stb} {where} limit {row+1}" + tdSql.query(sql) + val2 = copy.deepcopy(tdSql.getData(row, col)) + + if val1 == val2: + tdLog.info(f"{db}.{stb} {row},{col} source db:{val1} import db:{val2} both equal.") + else: + tdLog.exit(f"{db}.{stb} {row},{col} source db:{val1} len={len(val1)} import db:{val2} len={len(val2)} not equal.") + + + def verifyResult(self, db, newdb, json): + # compare with insert json + self.checkCorrectWithJson(json, newdb) + + # compare sum(pk) + stb = "meters" + self.checkAggSame(db, newdb, stb, "sum(ic)") + self.checkAggSame(db, newdb, stb, "sum(usi)") + self.checkProjSame(db, newdb, stb, 0, 3) + self.checkProjSame(db, newdb, stb, 0, 4) + self.checkProjSame(db, newdb, stb, 0, 6) # tag + + self.checkProjSame(db, newdb, stb, 8, 3) + self.checkProjSame(db, newdb, stb, 8, 4) + self.checkProjSame(db, newdb, stb, 8, 6) # tag + + # start kill + def startKillThread(self, taosadapter, presleep, sleep, count): + tdLog.info("call startKillThread ...\n") + self.stopEvent = Event() + self.thread = Thread(target=killTask, args=(self.stopEvent, taosadapter, presleep, sleep, count)) + self.thread.start() + + # stop kill + def stopKillThread(self): + tdLog.info("call stopKillThread begin...\n") + self.stopEvent.set() + self.thread.join() + tdLog.info("call stopKillThread end\n") + + def run(self): + # database + db = "redb" + newdb = "nredb" + + # find + taosdump, benchmark, taosadapter, tmpdir = self.findPrograme() + json = "./taosdump/ws3/json/retry.json" + + # insert data with taosBenchmark + self.insertData(benchmark, json, db) + + # start kill thread + self.startKillThread(taosadapter, 2, 5, 3) + + # dump out + self.dumpOut(taosdump, db, tmpdir) + + # stop kill + self.stopKillThread() + + # dump in + self.dumpIn(taosdump, db, newdb, tmpdir) + + # verify db + self.verifyResult(db, newdb, json) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py new file mode 100644 index 0000000000..175c6146ff --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py @@ -0,0 +1,150 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports big int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 BIGINT) tags(bntag BIGINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(9223372036854775807)") + tdSql.execute("insert into t2 values(1640000000000, 9223372036854775807)") + + tdSql.execute("create table t3 using st tags(-9223372036854775807)") + tdSql.execute("insert into t3 values(1640000000000, -9223372036854775807)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where bntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where bntag = 9223372036854775807") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 9223372036854775807) + tdSql.checkData(0, 2, 9223372036854775807) + + tdSql.query("select * from st where bntag = -9223372036854775807") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -9223372036854775807) + tdSql.checkData(0, 2, -9223372036854775807) + + tdSql.query("select * from st where bntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py new file mode 100644 index 0000000000..a40c61ca55 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py @@ -0,0 +1,144 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports binary + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 BINARY(5), c2 BINARY(5)) tags(btag BINARY(5))" + ) + tdSql.execute("create table t1 using st tags('test')") + tdSql.execute("insert into t1 values(1640000000000, '01234', '56789')") + tdSql.execute("insert into t1 values(1640000000001, 'abcd', 'efgh')") + tdSql.execute("create table t2 using st tags(NULL)") + tdSql.execute("insert into t2 values(1640000000000, NULL, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(2) + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert dbresult[i][0] in ("t1", "t2") + + tdSql.query("select distinct(btag) from st where tbname = 't1'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "test") + + tdSql.query("select distinct(btag) from st where tbname = 't2'") + tdSql.checkRows(1) + tdSql.checkData(0, 0, None) + + tdSql.query("select * from st where btag = 'test'") + tdSql.checkRows(2) + tdSql.checkData(0, 1, "01234") + tdSql.checkData(0, 2, "56789") + tdSql.checkData(1, 1, "abcd") + tdSql.checkData(1, 2, "efgh") + + tdSql.query("select * from st where btag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py new file mode 100644 index 0000000000..b30a06af9e --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py @@ -0,0 +1,149 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports bool + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 BOOL) tags(btag BOOL)") + tdSql.execute("create table t1 using st tags(true)") + tdSql.execute("insert into t1 values(1640000000000, true)") + tdSql.execute("create table t2 using st tags(false)") + tdSql.execute("insert into t2 values(1640000000000, false)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert ( + (dbresult[i][0] == "t1") + or (dbresult[i][0] == "t2") + or (dbresult[i][0] == "t3") + ) + + tdSql.query("select btag from st") + tdSql.checkRows(3) + dbresult = tdSql.queryResult + print(dbresult) + + tdSql.query("select * from st where btag = true") + tdSql.checkRows(1) + tdSql.checkData(0, 1, "True") + tdSql.checkData(0, 2, "True") + + tdSql.query("select * from st where btag = false") + tdSql.checkRows(1) + tdSql.checkData(0, 1, "False") + tdSql.checkData(0, 2, "False") + + tdSql.query("select * from st where btag is null") + dbresult = tdSql.queryResult + print(dbresult) + tdSql.checkRows(1) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py new file mode 100644 index 0000000000..3f6a1bbdd5 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py @@ -0,0 +1,174 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import math +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports double + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 DOUBLE) tags(dbtag DOUBLE)") + tdSql.execute("create table t1 using st tags(1.0)") + tdSql.execute("insert into t1 values(1640000000000, 1.0)") + + tdSql.execute("create table t2 using st tags(1.7E308)") + tdSql.execute("insert into t2 values(1640000000000, 1.7E308)") + + tdSql.execute("create table t3 using st tags(-1.7E308)") + tdSql.execute("insert into t3 values(1640000000000, -1.7E308)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where dbtag = 1.0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.0)) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 1.0)) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag = 1.7E308") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.7e308) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 1.7e308) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag = -1.7E308") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), -1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), -1.7e308) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), -1.7e308): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), -1.7e308) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where dbtag is null") + dbresult = tdSql.queryResult + print(dbresult) + + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py new file mode 100644 index 0000000000..6082162f5c --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py @@ -0,0 +1,170 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +import math +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports float + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 FLOAT) tags(ftag FLOAT)") + tdSql.execute("create table t1 using st tags(1.0)") + tdSql.execute("insert into t1 values(1640000000000, 1.0)") + + tdSql.execute("create table t2 using st tags(3.40E+38)") + tdSql.execute("insert into t2 values(1640000000000, 3.40E+38)") + + tdSql.execute("create table t3 using st tags(-3.40E+38)") + tdSql.execute("insert into t3 values(1640000000000, -3.40E+38)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where ftag = 1.0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 1.0): + tdLog.debug("getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 1.0)) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 1.0): + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag = 3.4E38") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), 3.4e38, rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), 3.4e38) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), 3.4e38, rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), 3.4e38) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag = -3.4E38") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + if not math.isclose(tdSql.getData(0, 1), (-3.4e38), rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 1), -3.4e38) + ) + tdLog.exit("data is different") + if not math.isclose(tdSql.getData(0, 2), (-3.4e38), rel_tol=1e-07, abs_tol=0.0): + tdLog.debug( + "getData(0, 1): %f, to compare %f" % (tdSql.getData(0, 2), -3.4e38) + ) + tdLog.exit("data is different") + + tdSql.query("select * from st where ftag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py new file mode 100644 index 0000000000..168362373f --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py @@ -0,0 +1,149 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 INT) tags(ntag INT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + tdSql.execute("create table t2 using st tags(2147483647)") + tdSql.execute("insert into t2 values(1640000000000, 2147483647)") + tdSql.execute("create table t3 using st tags(-2147483647)") + tdSql.execute("insert into t3 values(1640000000000, -2147483647)") + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where ntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where ntag = 2147483647") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 2147483647) + tdSql.checkData(0, 2, 2147483647) + + tdSql.query("select * from st where ntag = -2147483647") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -2147483647) + tdSql.checkData(0, 2, -2147483647) + + tdSql.query("select * from st where ntag is null") + dbresult = tdSql.queryResult + print(dbresult) + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py new file mode 100644 index 0000000000..936606ada8 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py @@ -0,0 +1,162 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12362] taosdump supports JSON + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 int) tags(jtag JSON)") + tdSql.execute('create table t1 using st tags(\'{"location": "beijing"}\')') + tdSql.execute("insert into t1 values(1500000000000, 1)") + + tdSql.execute("create table t2 using st tags(NULL)") + tdSql.execute("insert into t2 values(1500000000000, NULL)") + + tdSql.execute("create table t3 using st tags('')") + tdSql.execute("insert into t3 values(1500000000000, 0)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found in %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s" % (binPath, self.tmpdir)) + + tdSql.execute("drop database db") + + os.system("%s -R -i %s" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + for i in range(len(dbresult)): + assert ( + (dbresult[i][0] == "t1") + or (dbresult[i][0] == "t2") + or (dbresult[i][0] == "t3") + ) + + tdSql.query("select jtag->'location' from st") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + found = False + for i in range(len(dbresult)): + if dbresult[i][0] == '"beijing"': + found = True + break + + assert found == True + + tdSql.query("select * from st where jtag contains 'location'") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, '{"location":"beijing"}') + + tdSql.query("select jtag from st") + tdSql.checkRows(3) + + dbresult = tdSql.queryResult + print(dbresult) + found = False + for i in range(len(dbresult)): + if dbresult[i][0] == '{"location":"beijing"}': + found = True + break + + assert found == True + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py new file mode 100644 index 0000000000..073b56c61d --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py @@ -0,0 +1,148 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports small int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 SMALLINT) tags(sntag SMALLINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(32767)") + tdSql.execute("insert into t2 values(1640000000000, 32767)") + + tdSql.execute("create table t3 using st tags(-32767)") + tdSql.execute("insert into t3 values(1640000000000, -32767)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where sntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where sntag = 32767") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 32767) + tdSql.checkData(0, 2, 32767) + + tdSql.query("select * from st where sntag = -32767") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -32767) + tdSql.checkData(0, 2, -32767) + + tdSql.query("select * from st where sntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py new file mode 100644 index 0000000000..932d7d4d7f --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py @@ -0,0 +1,153 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports tiny int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute("create table st(ts timestamp, c1 TINYINT) tags(tntag TINYINT)") + tdSql.execute("create table t1 using st tags(1)") + tdSql.execute("insert into t1 values(1640000000000, 1)") + + tdSql.execute("create table t2 using st tags(127)") + tdSql.execute("insert into t2 values(1640000000000, 127)") + + tdSql.execute("create table t3 using st tags(-127)") + tdSql.execute("insert into t3 values(1640000000000, -127)") + + tdSql.execute("create table t4 using st tags(NULL)") + tdSql.execute("insert into t4 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(4) + + tdSql.query("select * from st where tntag = 1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 1) + tdSql.checkData(0, 2, 1) + + tdSql.query("select * from st where tntag = 127") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 127) + tdSql.checkData(0, 2, 127) + + tdSql.query("select * from st where tntag = -127") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, -127) + tdSql.checkData(0, 2, -127) + + tdSql.query("select * from st where tntag is null") + dbresult = tdSql.queryResult + print(dbresult) + + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py new file mode 100644 index 0000000000..cdc98d0a9b --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py @@ -0,0 +1,142 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12655] taosdump supports unsigned big int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 BIGINT UNSIGNED) \ + tags(ubntag BIGINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(18446744073709551614)") + tdSql.execute("insert into t2 values(1640000000000, 18446744073709551614)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where ubntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where ubntag = 18446744073709551614") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 18446744073709551614) + tdSql.checkData(0, 2, 18446744073709551614) + + tdSql.query("select * from st where ubntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py new file mode 100644 index 0000000000..12043fbbab --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py @@ -0,0 +1,144 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 INT UNSIGNED) tags(untag INT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(4294967294)") + tdSql.execute("insert into t2 values(1640000000000, 4294967294)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where untag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where untag = 4294967294") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 4294967294) + tdSql.checkData(0, 2, 4294967294) + + tdSql.query("select * from st where untag is null") + dbresult = tdSql.queryResult + print(dbresult) + + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py new file mode 100644 index 0000000000..f64c9f33a7 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py @@ -0,0 +1,142 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned small int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 SMALLINT UNSIGNED) \ + tags(usntag SMALLINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(65534)") + tdSql.execute("insert into t2 values(1640000000000, 65534)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where usntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where usntag = 65534") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 65534) + tdSql.checkData(0, 2, 65534) + + tdSql.query("select * from st where usntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py new file mode 100644 index 0000000000..d81640f654 --- /dev/null +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py @@ -0,0 +1,142 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def caseDescription(self): + """ + case1: [TD-12526] taosdump supports unsigned tiny int + """ + + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.tmpdir = "tmp" + + def getPath(self, tool="taosdump"): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] + else: + tdLog.info("Cannot find %s in path: %s" % (tool, selfPath)) + projPath = "/usr/local/taos/bin/" + + paths = [] + for root, dummy, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + return "" + return paths[0] + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + tdSql.execute("create database db keep 3649 ") + + tdSql.execute("use db") + tdSql.execute( + "create table st(ts timestamp, c1 TINYINT UNSIGNED) \ + tags(utntag TINYINT UNSIGNED)" + ) + tdSql.execute("create table t1 using st tags(0)") + tdSql.execute("insert into t1 values(1640000000000, 0)") + tdSql.execute("create table t2 using st tags(254)") + tdSql.execute("insert into t2 values(1640000000000, 254)") + tdSql.execute("create table t3 using st tags(NULL)") + tdSql.execute("insert into t3 values(1640000000000, NULL)") + + # sys.exit(1) + + binPath = self.getPath() + if binPath == "": + tdLog.exit("taosdump not found!") + else: + tdLog.info("taosdump found: %s" % binPath) + + if not os.path.exists(self.tmpdir): + os.makedirs(self.tmpdir) + else: + print("directory exists") + os.system("rm -rf %s" % self.tmpdir) + os.makedirs(self.tmpdir) + + os.system("%s -R -D db -o %s -T 1" % (binPath, self.tmpdir)) + + # sys.exit(1) + tdSql.execute("drop database db") + + os.system("%s -R -i %s -T 1" % (binPath, self.tmpdir)) + + tdSql.query("show databases") + dbresult = tdSql.queryResult + + found = False + for i in range(len(dbresult)): + print("Found db: %s" % dbresult[i][0]) + if dbresult[i][0] == "db": + found = True + break + + assert found == True + + tdSql.execute("use db") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st") + + tdSql.query("show tables") + tdSql.checkRows(3) + + tdSql.query("select * from st where utntag = 0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 0) + tdSql.checkData(0, 2, 0) + + tdSql.query("select * from st where utntag = 254") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1640000000000) + tdSql.checkData(0, 1, 254) + tdSql.checkData(0, 2, 254) + + tdSql.query("select * from st where utntag is null") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + tdSql.checkData(0, 1, None) + tdSql.checkData(0, 2, None) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase())