From 022d6ea765ec90e23968cedb95eabac6fbd3f2e4 Mon Sep 17 00:00:00 2001 From: bryanchang0603 Date: Fri, 25 Jun 2021 15:41:47 +0800 Subject: [PATCH] taosdemoCfg adding how to use and minor bug fix --- tests/pytest/util/taosdemoCfg.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/pytest/util/taosdemoCfg.py b/tests/pytest/util/taosdemoCfg.py index 5071e915a5..d211f86b81 100644 --- a/tests/pytest/util/taosdemoCfg.py +++ b/tests/pytest/util/taosdemoCfg.py @@ -25,6 +25,21 @@ from multiprocessing import cpu_count # TODO: fully test the function. Handle exceptions. # Handle json format not accepted by taosdemo + +### How to use TaosdemoCfg: +# Before you start: +# Make sure you understand how is taosdemo's JSON file structured. Because the python used does +# not support directory in directory for self objects, the config is being tear to different parts. +# Please make sure you understand which directory represent which part of which type of the file +# This module will reassemble the parts when creating the JSON file. +# +# Basic use example +# step 1:use self.append_sql_stb() to append the insert/query/subscribe directory into the module +# you can append many insert/query/subscribe directory, but pay attention about taosdemo's limit +# step 2:use alter function to alter the specific config +# step 3:use the generation function to generate the files +# +# step 1 and step 2 can be replaced with using import functions class TDTaosdemoCfg: def __init__(self): self.insert_cfg = { @@ -264,7 +279,7 @@ class TDTaosdemoCfg: elif key == "super_table_query": self.query_cfg["super_table_query"] = self.stable_query else: - self.table_query[key] = value + self.query_cfg[key] = value def alter_sub_cfg(self, key, value): if key == "specified_table_query": @@ -272,7 +287,7 @@ class TDTaosdemoCfg: elif key == "super_table_query": self.sub_cfg["super_table_query"] = self.stable_sub else: - self.table_query[key] = value + self.sub_cfg[key] = value def alter_sub_stb(self, key, value): if key == "sqls": -- GitLab