提交 8ef1606d 编写于 作者: G Ganlin Zhao

[TD-6645/test]: Add some testcases.

上级 1949ceb6
......@@ -1090,9 +1090,10 @@ void verify_telnet_insert(TAOS* taos) {
//bigint
char* lines2_3[] = {
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\""
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_3, 2);
code = taos_insert_telnet_lines(taos, lines2_3, 3);
if (code) {
printf("lines2_3 code: %d, %s.\n", code, tstrerror(code));
}
......@@ -1107,11 +1108,10 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833690ms 3.15 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_4, 11);
code = taos_insert_telnet_lines(taos, lines2_4, 10);
if (code) {
printf("lines2_4 code: %d, %s.\n", code, tstrerror(code));
}
......@@ -1127,9 +1127,10 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\""
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_5, 10);
code = taos_insert_telnet_lines(taos, lines2_5, 11);
if (code) {
printf("lines2_5 code: %d, %s.\n", code, tstrerror(code));
}
......@@ -1166,7 +1167,7 @@ void verify_telnet_insert(TAOS* taos) {
//nchar
char* lines2_8[] = {
"stb2_8 1626006833610ms L\"nchar_val数值一\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\"",
"stb2_8 1626006833620ms L\"nchar_val数值二\" host=\"host0\""
};
code = taos_insert_telnet_lines(taos, lines2_8, 2);
if (code) {
......
......@@ -31,6 +31,27 @@ class TDTestCase:
### Default format ###
### metric ###
print("============= step0 : test metric ================")
payload = '''
{
"metric": ".stb.0.",
"timestamp": 1626006833610123,
"value": 10,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe _stb_0_")
tdSql.checkRows(6)
### metric value ###
print("============= step1 : test metric value types ================")
payload = '''
......@@ -50,7 +71,7 @@ class TDTestCase:
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_0")
tdSql.checkData(1, 1, "FLOAT")
tdSql.checkData(1, 1, "BIGINT")
payload = '''
{
......@@ -107,12 +128,52 @@ class TDTestCase:
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_3")
tdSql.checkData(1, 1, "NCHAR")
tdSql.checkData(1, 1, "BINARY")
### timestamp 0 ###
payload = '''
{
"metric": "stb0_4",
"timestamp": 1626006833610123,
"value": 3.14,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_4")
tdSql.checkData(1, 1, "DOUBLE")
payload = '''
{
"metric": "stb0_5",
"timestamp": 1626006833610123,
"value": 3.14E-2,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_5")
tdSql.checkData(1, 1, "DOUBLE")
print("============= step2 : test timestamp ================")
### timestamp 0 ###
payload = '''
{
"metric": "stb0_6",
"timestamp": 0,
"value": 123,
"tags": {
......@@ -127,14 +188,15 @@ class TDTestCase:
print("insert_json_payload result {}".format(code))
print("============= step3 : test tags ================")
### ID ###
payload = '''
{
"metric": "stb0_5",
"metric": "stb0_7",
"timestamp": 0,
"value": 123,
"tags": {
"ID": "tb0_5",
"ID": "tb0_7",
"t1": true,
"iD": "tb000",
"t2": false,
......@@ -147,10 +209,60 @@ class TDTestCase:
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("select tbname from stb0_5")
tdSql.checkData(0, 0, "tb0_5")
tdSql.query("select tbname from stb0_7")
tdSql.checkData(0, 0, "tb0_7")
### Default tag numeric types ###
payload = '''
{
"metric": "stb0_8",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_8")
tdSql.checkData(2, 1, "BIGINT")
payload = '''
{
"metric": "stb0_9",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123.00
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_9")
tdSql.checkData(2, 1, "DOUBLE")
payload = '''
{
"metric": "stb0_10",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123E-1
}
}
'''
code = self._conn.insert_json_payload(payload)
print("insert_json_payload result {}".format(code))
tdSql.query("describe stb0_10")
tdSql.checkData(2, 1, "DOUBLE")
### Nested format ###
print("============= step4 : test nested format ================")
### timestamp ###
#seconds
payload = '''
......
......@@ -36,13 +36,14 @@ class TDTestCase:
"stb0_0 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_1 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
"stb0_2 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
".stb0.3. 1626006833639000000ns 4i8 host=\"host0\" interface=\"eth0\"",
]
code = self._conn.insert_telnet_lines(lines0)
print("insert_telnet_lines result {}".format(code))
tdSql.query("show stables")
tdSql.checkRows(3)
tdSql.checkRows(4)
tdSql.query("describe stb0_0")
tdSql.checkRows(4)
......@@ -53,6 +54,9 @@ class TDTestCase:
tdSql.query("describe stb0_2")
tdSql.checkRows(4)
tdSql.query("describe _stb0_3_")
tdSql.checkRows(4)
### timestamp ###
print("============= step2 : test timestamp ================")
lines1 = [
......@@ -122,14 +126,15 @@ class TDTestCase:
#bigint
lines2_3 = [
"stb2_3 1626006833651ms -9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\""
"stb2_3 1626006833652ms 9223372036854775807i64 host=\"host0\"",
"stb2_3 1626006833662ms 9223372036854775807 host=\"host0\""
]
code = self._conn.insert_telnet_lines(lines2_3)
print("insert_telnet_lines result {}".format(code))
tdSql.query("select * from stb2_3")
tdSql.checkRows(2)
tdSql.checkRows(3)
tdSql.query("describe stb2_3")
tdSql.checkRows(3)
......@@ -145,7 +150,6 @@ class TDTestCase:
"stb2_4 1626006833660ms -3.4e10f32 host=\"host0\"",
"stb2_4 1626006833670ms 3.4E+2f32 host=\"host0\"",
"stb2_4 1626006833680ms -3.4e-2f32 host=\"host0\"",
"stb2_4 1626006833690ms 3.15 host=\"host0\"",
"stb2_4 1626006833700ms 3.4E38f32 host=\"host0\"",
"stb2_4 1626006833710ms -3.4E38f32 host=\"host0\""
]
......@@ -154,7 +158,7 @@ class TDTestCase:
print("insert_telnet_lines result {}".format(code))
tdSql.query("select * from stb2_4")
tdSql.checkRows(11)
tdSql.checkRows(10)
tdSql.query("describe stb2_4")
tdSql.checkRows(3)
......@@ -171,14 +175,15 @@ class TDTestCase:
"stb2_5 1626006833670ms 3.4E+2f64 host=\"host0\"",
"stb2_5 1626006833680ms -3.4e-2f64 host=\"host0\"",
"stb2_5 1626006833690ms 1.7E308f64 host=\"host0\"",
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\""
"stb2_5 1626006833700ms -1.7E308f64 host=\"host0\"",
"stb2_5 1626006833710ms 3.15 host=\"host0\""
]
code = self._conn.insert_telnet_lines(lines2_5)
print("insert_telnet_lines result {}".format(code))
tdSql.query("select * from stb2_5")
tdSql.checkRows(10)
tdSql.checkRows(11)
tdSql.query("describe stb2_5")
tdSql.checkRows(3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册