coverage: add test case for db encrypt

This commit is contained in:
Ping Xiao 2024-05-29 17:29:31 +08:00
parent 8cf5beb3a5
commit 4f49cb7940
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,63 @@
import taos
import sys
import os
import subprocess
import glob
import shutil
import time
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.srvCtl import *
from frame.caseBase import *
from frame import *
from frame.autogen import *
# from frame.server.dnodes import *
# from frame.server.cluster import *
class TDTestCase(TBase):
def init(self, conn, logSql, replicaVar=1):
super(TDTestCase, self).init(conn, logSql, replicaVar=1, checkColName="c1")
self.valgrind = 0
self.db = "test"
self.stb = "meters"
self.childtable_count = 10
tdSql.init(conn.cursor(), logSql)
def create_encrypt_db(self):
tdSql.execute("create encrypt_key '1234567890'")
autoGen = AutoGen()
autoGen.create_db(self.db, 2, 1, "ENCRYPT_ALGORITHM 'sm4'")
tdSql.execute(f"use {self.db}")
autoGen.create_stable(self.stb, 2, 3, 8, 8)
autoGen.create_child(self.stb, "d", self.childtable_count)
autoGen.insert_data(1000)
tdSql.query(f"select * from {self.db}.{self.stb}")
tdSql.checkRows(1000 * self.childtable_count)
self.timestamp_step = 1000
self.insert_rows = 1000
self.checkInsertCorrect()
def create_encrypt_db_error(self):
tdSql.error("create encrypt_key '123'")
tdSql.error("create encrypt_key '12345678abcdefghi'")
tdSql.error("create database test ENCRYPT_ALGORITHM 'sm4'")
def run(self):
self.create_encrypt_db_error()
self.create_encrypt_db()
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())

View File

@ -11,6 +11,7 @@
# army-test
#
,,y,army,./pytest.sh python3 ./test.py -f enterprise/multi-level/mlevel_basic.py -N 3 -L 3 -D 2
,,y,army,./pytest.sh python3 ./test.py -f enterprise/db-encrypt/basic.py
,,n,army,python3 ./test.py -f enterprise/s3/s3Basic.py -N 3
,,y,army,./pytest.sh python3 ./test.py -f community/cluster/snapshot.py -N 3 -L 3 -D 2
,,y,army,./pytest.sh python3 ./test.py -f community/query/function/test_func_elapsed.py