From 0cc1c412af1001986489520b8c6f69491d96ab3c Mon Sep 17 00:00:00 2001 From: Chris Zhai Date: Wed, 15 May 2024 19:50:25 +0800 Subject: [PATCH] add test cases for TD-29196 --- tests/army/community/insert/insert_basic.py | 86 +++++++++++++++++++++ tests/parallel_test/cases.task | 1 + 2 files changed, 87 insertions(+) create mode 100644 tests/army/community/insert/insert_basic.py diff --git a/tests/army/community/insert/insert_basic.py b/tests/army/community/insert/insert_basic.py new file mode 100644 index 0000000000..481db4eadd --- /dev/null +++ b/tests/army/community/insert/insert_basic.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 sys +import time +import random + +import taos +import frame +import frame.etool + + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * + + +class TDTestCase(TBase): + + def checkGeometry(self): + tdLog.info(f"check geometry") + + tdSql.execute("create database db_geometry;") + tdSql.execute("use db_geometry;") + tdSql.execute("create table t_ge (ts timestamp, id int, c1 GEOMETRY(512));") + tdSql.execute("insert into t_ge values(now, 1, 'MULTIPOINT ((0 0), (1 1))');") + tdSql.execute("insert into t_ge values(now, 1, 'MULTIPOINT (0 0, 1 1)');") + tdSql.execute("insert into t_ge values(now, 2, 'POINT (0 0)');") + tdSql.execute("insert into t_ge values(now, 2, 'POINT EMPTY');") + tdSql.execute("insert into t_ge values(now, 3, 'LINESTRING (0 0, 0 1, 1 2)');") + tdSql.execute("insert into t_ge values(now, 3, 'LINESTRING EMPTY');") + tdSql.execute("insert into t_ge values(now, 4, 'POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))');") + tdSql.execute("insert into t_ge values(now, 4, 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))');") + tdSql.execute("insert into t_ge values(now, 4, 'POLYGON EMPTY');") + tdSql.execute("insert into t_ge values(now, 5, 'MULTILINESTRING ((0 0, 1 1), (2 2, 3 3))');") + tdSql.execute("insert into t_ge values(now, 6, 'MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1, 1 1)), ((4 3, 6 3, 6 1, 4 1, 4 3)))');") + tdSql.execute("insert into t_ge values(now, 7, 'GEOMETRYCOLLECTION (MULTIPOINT((0 0), (1 1)), POINT(3 4), LINESTRING(2 3, 3 4))');") + tdSql.query("select * from t_ge;") + tdSql.checkRows(12) + tdSql.query("select * from t_ge where id=1;") + tdSql.checkRows(2) + tdSql.query("select * from t_ge where id=2;") + tdSql.checkRows(2) + tdSql.query("select * from t_ge where id=3;") + tdSql.checkRows(2) + tdSql.query("select * from t_ge where id=4;") + tdSql.checkRows(3) + tdSql.query("select * from t_ge where id=5;") + tdSql.checkRows(1) + tdSql.query("select * from t_ge where id=6;") + tdSql.checkRows(1) + tdSql.query("select * from t_ge where id=7;") + tdSql.checkRows(1) + + def checkDataType(self): + tdLog.info(f"check datatype") + + self.checkGeometry() + + + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # check insert datatype + self.checkDataType() + + tdLog.success(f"{__file__} successfully executed") + + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 816288b5e9..39267b2a0e 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -20,6 +20,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f community/query/fill/fill_desc.py -N 3 -L 3 -D 2 ,,y,army,./pytest.sh python3 ./test.py -f community/cluster/incSnapshot.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/query/query_basic.py -N 3 +,,y,army,./pytest.sh python3 ./test.py -f community/insert/insert_basic.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/cluster/splitVgroupByLearner.py -N 3 ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py ,,n,army,python3 ./test.py -f community/query/show.py -N 3